Last active
June 14, 2018 17:09
-
-
Save sergiolucero/24b9c7d0c5ab223ff2da16beb5712e7c to your computer and use it in GitHub Desktop.
Training cars on Google colab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #from google.colab import files;uploaded = files.upload() | |
| #!pip install TPOT | |
| from tpot import TPOTRegressor | |
| from sklearn.model_selection import train_test_split | |
| df=pd.read_csv('32928_chile_autos.csv') | |
| df=df[(df.Año>1980)&(df.Kilometraje>1000)&(df.Precio<100000000)&(df.Precio>1000000)] | |
| data_columns = df.columns[2:-1] # add some more! | |
| target_columns = df.columns[-1] # use logs! | |
| X,y = df[data_columns], df[target_columns] | |
| tt = train_test_split(X.values, y.values,train_size=0.75, test_size=0.25) | |
| Xtrain,Xtest,ytrain,ytest=tt | |
| tp = TPOTRegressor(generations, population_size, verbosity=verbosity, | |
| scoring='negative_absolute_mean_error', | |
| config_dict='TPOT MDR', | |
| scoring='balanced_accuracy') | |
| tp.fit(Xtrain, ytrain) | |
| y_fit = tp.predict(X_test) | |
| tp.export(os.path.join(MODEL_FOLDER, 'tpot_cars_pipeline.py')) | |
| print(tp.score(Xtest, ytest)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment