@@ -0,0 +1,1383 @@
+import graphlab as gl%0A%0A#Logistic Regression Model to predict whether a resturant is good or bad.%0A%0A# If the average star rating is greater than or equal to 3 , the restuarant is predicted as good else bad.%0A%0A#Read the review, business and user yelp data into graphlab Sframe for linear regression.%0A%0Areview = gl.Sframe('review.csv')%0Auser = gl.Sframe('user.csv')%0Abusiness = gl.Sframe('business.csv')%0A%0A%0A#join business, review and user dataset %0A%0Ajoin_review_business = business.join(review, how='inner', on='business_id')%0A%0Ajoin_review_business_user = join_review_business.join(user, how = 'inner', on = %22user_id%22) %0A%0A%0A# Predict class label. If the average star rating is greater than or equal to 3 , the restuarant is predicted as good else bad.%0A%0Ajoin_review_business%5B'good'%5D = join_review_business%5B'stars'%5D %3E= 3%0A%0Atrain_set, test_set = user_business_review_table.random_split(0.7, seed=5)%0A%0A#Train the model using the training sets%0A%0Amodel = gl.logistic_classifier.create(train_set, target='good', %0A                                    features = %5B'business_stars','business_review_count', %0A                                                'user_review_count', 'user_average_stars'%5D)%0A%0A#predict the logistic classifier%0A%0Amodel= model.predict(test_set)%0A%0A%0A#finds the mean square error.%0A%0Aresult = model.evaluate(test_set)%0A%0A#print results%0A%0Aprint(result%5B'accuracy'%5D)%0Aprint(result%5B'confusion_matrix'%5D)%0A

Logistic Regression Yelp