SHARE
TWEET

Untitled

a guest Jun 24th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. test_df= pd.DataFrame({'Year': ['2012', '2013', '2014', '2015', '2012', '2013', '2014', '2015', '2012', '2013', '2014', '2015'],
  2.                        'Theft': [100,200,300,230, 20,34,56, 65, 43,56,79,109],
  3.                        'Robbery': [100,200,300,230, 20,34,56, 65, 43,56,79,109],
  4.                        'Assult': [102,230,320,235, 201,343,90, 106, 143,156,179,102],
  5.                      'Area': ['Chicago, IL metro area', 'Chicago, IL metro area', 'Chicago, IL metro area', 'Chicago, IL metro area', 'Chicago, IL', 'Chicago, IL', 'Chicago, IL', 'Chicago, IL', 'Chicago, IL - Albany Park', 'Chicago, IL - Albany Park', 'Chicago, IL - Albany Park', 'Chicago, IL - Albany Park'],
  6.                      'yearly_sale_percentage': ['5%', '10%', '7%','21%', '15%', '12%', '2%','21%', '10%', '11%', '12%','6%'],
  7.                      'price_status':[0, 1, 0,1,1,1,0,1,1,1,1,0]})
  8.      
  9. from sklearn.feature_extraction.text import TfidfVectorizer
  10. vectorizer = TfidfVectorizer()
  11.  
  12. X= test_df.drop('price_status', axis=1)
  13. X= vectorizer.fit_transform(X)
  14. y= vectorizer.fit_transform(test_df['price_status'])
  15.  
  16. clf =  sklearn.svm.SVC(kernel=kernel)
  17. clf.fit(X,y)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top