<jupyter_start><jupyter_text>Новый раздел<jupyter_code>!pip install catboost
data2 = data.drop(data.columns[14:18], axis=1)

from catboost import CatBoostRegressor
cat_feat = ["bedrooms",'bathrooms','sqft_living','sqft_lot',
'floors','waterfront','view','condition','sqft_above','sqft_basement',
'yr_built','yr_renovated','lat','lon']

X = data2.values[::, 2:16]
y = data2.values[::, 1:2]

from sklearn.model_selection import train_test_split as train
X_train, X_test, y_train, y_test = train(X, y, test_size=0.6)

clf = CatBoostRegressor(iterations=3500,learning_rate=0.03,od_type='Iter',od_wait=1500,
                             depth=6,random_strength=1,
                            l2_leaf_reg=10,
                             sampling_frequency='PerTree',
                             
                            )
res = clf.fit(X_train, y_train,
             eval_set=(X_test,y_test),
             use_best_model=True,
             verbose=True)
print(clf.score(X_train, y_train))
print(clf.score(X_test, y_test))
import pickle

with open("model.pkl", "wb") as f:
    pickle.dump(clf, f)
clf.save_model("model")
sr = 0
ind = 0
for a, b in zip(clf.predict(X_test), y_test):
    #print(a, b)
    #print(abs((b-a)/b * 100))
    if b != 0:
      sr+=abs((b-a)/b * 100)
      ind+=1
sr/=ind
sr=100-sr
print(sr) 
print(clf.score(X_train, y_train))
print(clf.score(X_test, y_test))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1529745042492918, 'fraction_numerical': 0.031161473087818695, 'mean_word_length': 3.1804733727810652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '652221', 'license': 'MIT', 'n_tokens_mistral': 577, 'n_tokens_neox': 543, 'n_words': 86, 'path': 'CatBoostPriceV2.ipynb', 'repo_name': 'Skvayzer/MLminiprojects', 'size': '1412'}