import graphlab
What is the import statement for the cool framework for visualization?
dataSet=graphlab.SFrame('nameoffile.csv')
How do you import a csv?
sFrame.show()
How do you visual a SFrame?
graphlab.
canvas.set_target('ipynb')
How do you get visualizations to show up inline in iPython?
view(='Scatter plot'), x, y variables
What do you need for a SFrame visualization?
sales.show(view="Scatter Plot", x="sqft_living", y="price")
How do you make a scatterplot with a SFrame of sales for the values of price vs. squareFeet?
column names
In a SFrame scatter plot show function, do you need quotations for the column names, the variable names, both or neither?
train_data,test_data = sales.random_split(.8,seed=0)
How do you split up a training test set?
training data, target='nameoffieldforYaxis', featuresList, validation_set(=None)
What do you need for a regression?
sqft_model = graphlab.linear_regression.create(train_data, target='price', features=['sqft_living'],validation_set=None)
How would you write a regression?
evaluate print sqft_model.evaluate(test_data)
How do you have Python check your model?
print sqft_model.evaluate(test_data)
How do you get it to check the mean?
sqft_model.get('coefficients')
How do you get the values of the model?
sqft_model.get('coefficients')
How do you make a box whiskers plot?
print my_features_model.predict(features)
How do you make your model predict?
How do you get a dictionary of word counts?
products['word_count'] = graphlab.text_analytics.count_words(products['review'])
How do you show a categorical view?
giraffe_reviews['rating'].show(view='Categorical')
How do you create a sentiment classifier?
sentiment_model = graphlab.logistic_classifier.create(train_data,
target='sentiment',
features=['word_count'],
validation_set=test_data)
How do show the text for a ROC curve?
sentiment_model.evaluate(test_data, metric='roc_curve')
How do you view a ROC curve for a sentiment model?
sentiment_model.evaluate(test_data, metric='roc_curve')
sentiment_model.show(view='Evaluation')
What is accuracy
TP + TF/Total
How do you view the prediction probability?
giraffe_reviews['predicted_sentiment'] = sentiment_model.predict(giraffe_reviews, output_type='probability')
What are the parameters for sort()?
column name, ascending=True or False
How do you show coefficients for a model?
model_name["coefficients"] after running
How do you evaluate a model?
model_name.evaluate(test_data)
How do you compute nearest neighbor?
knn_model = graphlab.nearest_neighbors.create(people,features=['tfidf'],label='name')
How do you compute distance (similarity really)?
graphlab.distances.cosine(obama['tfidf'][0],clinton['tfidf'][0])
How do you compute tdf?
tfidf = graphlab.text_analytics.tf_idf(people['word_count'])
How do you create a table from tfidf info?
obama[['tfidf']].stack('tfidf',new_column_name=['word','tfidf']).sort('tfidf',ascending=False)
How do get nearest people in nearest neighbor?
knn_model.query(jolie)
Recommender system recall is
#liked and #shown /(over) #liked
Recommender system precision is
#liked and #shown/#shown