<jupyter_start><jupyter_text>DECISION TREE<jupyter_code>model = DecisionTreeRegressor(max_depth=5)
run_model(model, cat_feats)<jupyter_output><empty_output><jupyter_text>RANDOM FOREST<jupyter_code>model = RandomForestRegressor(max_depth=5, n_estimators=50, random_state=8888)
run_model(model, cat_feats)<jupyter_output><empty_output><jupyter_text>XGBOOST<jupyter_code>xgb_params ={
     'max_depth' :5, 
     'n_estimators' : 50, 
      'learning_rate': 0.1,
      'seed' : 8888
} 
model = xgb.XGBRegressor(** xgb_params)
run_model(model, cat_feats)
model = xgb.XGBRegressor(** xgb_params)
model.fit(X,y)

imp = PermutationImportance(model, random_state=8888).fit(X,y)
eli5.show_weights(imp, feature_names = cat_feats)
feats = ['param_napęd__cat',
'param_rok-produkcji__cat',
'param_stan__cat',
'param_skrzynia-biegów__cat',
'param_faktura-vat__cat',
'param_moc__cat',
'param_marka-pojazdu__cat',
'feature_kamera-cofania__cat',
'param_typ__cat',
'seller_name__cat',
'param_pojemność-skokowa__cat',
'feature_wspomaganie-kierownicy__cat',
'param_model-pojazdu__cat',
'param_wersja__cat',
'param_kod-silnika__cat',
'feature_system-start-stop__cat',
'feature_asystent-pasa-ruchu__cat',
'feature_czujniki-parkowania-przednie__cat',
'feature_łopatki-zmiany-biegów__cat',
'feature_regulowane-zawieszenie__cat']
run_model(model, feats)
df['param_rok-produkcji'].unique()
df['rok produkcji'] = df['param_rok-produkcji'].map(lambda x: -1 if str(x)=="None" else int(x))
feats = ['param_napęd__cat',
'rok produkcji',
'param_stan__cat',
'param_skrzynia-biegów__cat',
'param_faktura-vat__cat',
'param_moc__cat',
'param_marka-pojazdu__cat',
'feature_kamera-cofania__cat',
'param_typ__cat',
'seller_name__cat',
'param_pojemność-skokowa__cat',
'feature_wspomaganie-kierownicy__cat',
'param_model-pojazdu__cat',
'param_wersja__cat',
'param_kod-silnika__cat',
'feature_system-start-stop__cat',
'feature_asystent-pasa-ruchu__cat',
'feature_czujniki-parkowania-przednie__cat',
'feature_łopatki-zmiany-biegów__cat',
'feature_regulowane-zawieszenie__cat']
run_model(model, feats)
df['moc'] = df['param_moc'].map(lambda x: -1 if str(x)=="None" else int(x.split(' ')[0]))
feats = ['param_napęd__cat',
'rok produkcji',
'param_stan__cat',
'param_skrzynia-biegów__cat',
'param_faktura-vat__cat',
'moc',
'param_marka-pojazdu__cat',
'feature_kamera-cofania__cat',
'param_typ__cat',
'seller_name__cat',
'param_pojemność-skokowa__cat',
'feature_wspomaganie-kierownicy__cat',
'param_model-pojazdu__cat',
'param_wersja__cat',
'param_kod-silnika__cat',
'feature_system-start-stop__cat',
'feature_asystent-pasa-ruchu__cat',
'feature_czujniki-parkowania-przednie__cat',
'feature_łopatki-zmiany-biegów__cat',
'feature_regulowane-zawieszenie__cat']
run_model(model, feats)
df['pojemnosc_skokowa'] = df['param_pojemność-skokowa'].map(lambda x: -1 if str(x)=="None" else int(x.split('cm')[0].replace(' ','')))
feats = ['param_napęd__cat',
'rok produkcji',
'param_stan__cat',
'param_skrzynia-biegów__cat',
'param_faktura-vat__cat',
'moc',
'param_marka-pojazdu__cat',
'feature_kamera-cofania__cat',
'param_typ__cat',
'seller_name__cat',
'pojemnosc_skokowa',
'feature_wspomaganie-kierownicy__cat',
'param_model-pojazdu__cat',
'param_wersja__cat',
'param_kod-silnika__cat',
'feature_system-start-stop__cat',
'feature_asystent-pasa-ruchu__cat',
'feature_czujniki-parkowania-przednie__cat',
'feature_łopatki-zmiany-biegów__cat',
'feature_regulowane-zawieszenie__cat']
run_model(model, feats)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15025906735751296, 'fraction_numerical': 0.007772020725388601, 'mean_word_length': 11.10801393728223, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '278680', 'license': 'MIT', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1533, 'n_words': 156, 'path': 'Matrix II/Matrix II Day 4.ipynb', 'repo_name': 'andrzej-malina/data_workshop_matrix', 'size': '3474'}