id int64 0 7.95k | code_block stringlengths 1 52.9k | too_long stringclasses 2
values | marks int64 1 5 | graph_vertex_id float64 1 88 | graph_vertex_class stringclasses 12
values | graph_vertex_subclass stringclasses 70
values | kernel_id float64 25.8k 14.7M ⌀ | sqale_rating float64 1 4 | maintainability_rating stringclasses 4
values | code_smells int64 0 36 | complexity float64 0 15 ⌀ | cognitive_complexity int64 0 33 | bugs int64 0 7 | sqale_index int64 0 125 | ncloc float64 0 101 ⌀ | mlscent_analysis_status stringclasses 3
values | mlscent_smell_count int64 0 31 | mlscent_unique_smell_count int64 0 12 | mlscent_findings_json stringlengths 2 7.76k | mlscent_ml_rating stringclasses 5
values | mlscent_ml_rating_basis stringclasses 52
values | mlscent_ml_findings_json stringclasses 50
values | mlscent_ignored_findings_json stringclasses 199
values | context_line_count int64 0 33 | combined_rating stringclasses 5
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,303 | ## Split Training Data
from sklearn.cross_validation import train_test_split
num_test = 0.10
X_train, X_test, y_train, y_test = train_test_split(features, labels, test_size=num_test, random_state=23)
## Out of box random forest
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklea... | Yes | 4 | 7 | Model_Train | train_model | 91,963 | 2 | B | 3 | 0 | 0 | 0 | 15 | 7 | ok | 8 | 7 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear... | B | Cross Validation Checker=low, Cross-validation not detected=low, Randomness Control Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}] | ["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 5 | B |
6,304 | ## Training Predictions
proba = clf.predict_proba(X_test)
preds = proba[:,1]
score = roc_auc_score(y_test, preds)
print("Area under ROC {0}".format(score)) | No | 4 | 49 | Model_Evaluation | compute_test_metric | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,305 | sub = pd.DataFrame()
sub["listing_id"] = df["listing_id"]
for label in ["high", "medium", "low"]:
sub[label] = y[:, labels2idx[label]]
sub.to_csv("submission_ky.csv", index=False)
| Yes | 3 | 12 | Data_Transform | create_dataframe | null | 1 | A | 0 | 1 | 1 | 0 | 0 | 5 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,306 | df[num_feats]
| No | 5 | 41 | Debug | show_table | 241,414 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 5 | A |
6,307 | # objective is to predict a number of listing enquiries based on features
train = pd.read_json("../input/train.json", "r")
test = pd.read_json("../input/test.json", "r")
sample_sub = pd.read_csv("../input/sample_submission.csv")
| Yes | 4 | 44 | Data_Extraction | load_from_disk | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,308 | train["num_photos"] = train["photos"].apply(len)
train["num_features"] = train["features"].apply(len)
train["num_description_words"] = train["description"].apply(lambda x: len(x.split(" ")))
train["created"] = pd.to_datetime(train["created"])
train["created_year"] = train["created"].dt.year
train["created_month"] = tra... | No | 5 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 7 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,309 | test["num_photos"] = test["photos"].apply(len)
test["num_features"] = test["features"].apply(len)
test["num_description_words"] = test["description"].apply(lambda x: len(x.split(" ")))
test["created"] = pd.to_datetime(test["created"])
test["created_year"] = test["created"].dt.year
test["created_month"] = test["created"... | No | 5 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 7 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,310 | from sklearn.linear_model import LogisticRegression
| No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 0 | A |
6,311 | lr = LogisticRegression()
| No | 5 | 4 | Model_Train | choose_model_class | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,312 | y = model.predict_proba(test)
| No | 5 | 48 | Model_Evaluation | predict_on_test | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,313 | y_dat = pd.DataFrame(y)
| No | 5 | 12 | Data_Transform | create_dataframe | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,314 | #y_dat.copy(deep = False)
y_dat.loc[:,'listing_id'] = test.index
| No | 5 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,315 | y_dat.rename(columns = {'0':'medium', '1':'low', '2':'high'}, inplace = True)
| No | 5 | 61 | Data_Transform | rename_columns | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,316 | data.head()
| No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,317 | # Convert the dataframe to a CSV
data.to_csv("sub_ky_3.csv", index = False)
| No | 5 | 25 | Data_Export | save_to_csv | 241,722 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
6,318 | import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (12,8)
%matplotlib inline | No | 4 | 22 | Environment | import_modules | 242,073 | 1 | A | 0 | null | 0 | 0 | 0 | null | invalid_python | 0 | 0 | [] | null | invalid_python | [] | [] | 6 | null |
6,319 | df_stores = pd.read_csv('../input/store.csv', sep=',')
df_data = pd.read_csv('../input/train.csv', sep=',')
df_test = pd.read_csv('../input/test.csv', sep=',') | No | 5 | 45 | Data_Extraction | load_from_csv | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 4 | 2 | [{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har... | A | no applicable ML-specific findings | [] | ["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."] | 6 | A |
6,320 | print(df_stores.shape)
print(df_data.shape)
print(df_test.shape) | No | 5 | 58 | Debug | show_shape | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 6 | A |
6,321 | # <br>df_stores = df_stores.drop('CompetitionOpenSinceMonth', axis=1).drop('CompetitionOpenSinceYear', axis=1).drop('Promo2SinceWeek', axis=1).drop('Promo2SinceYear', axis=1) | No | 5 | 10 | Data_Transform | drop_column | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,322 | df_stores.head() | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,323 | df_data.head() | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,324 | df_test.head() | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,325 | # , <br>closed_stores = df_test["Id"][df_test["Open"] == 0].values<br>df_test = df_test[df_test["Open"] != 0]<br>df_data = df_data[df_data["Open"] != 0] | No | 5 | 14 | Data_Transform | filter | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,326 | # , <br>df_data = df_data.drop('Open', axis=1).drop('Customers', axis=1)<br>df_test = df_test.drop('Open', axis=1) | No | 5 | 10 | Data_Transform | drop_column | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,327 | # <br>df_data['Month'] = df_data['Date'].apply(lambda x: int(x[5:7]))<br>df_test['Month'] = df_test['Date'].apply(lambda x: int(x[5:7]))<br>df_data['Year'] = df_data['Date'].apply(lambda x: int(x[:4]))<br>df_test['Year'] = df_test['Date'].apply(lambda x: int(x[:4]))<br>df_test = df_test.drop('Date', axis=1)<br>df_d... | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,328 | # - ,<br># . ., .<br>df_stores = df_stores.join(df_data.groupby('Store')['Sales'].mean(), on='Store').rename(columns={'Sales': 'Av_sales'}) | Yes | 4 | 61 | Data_Transform | rename_columns | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,329 | # <br>max_s = df_stores['Av_sales'].max()<br>df_stores['Av_sales']=df_stores['Av_sales']/max_s | No | 5 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,330 | df_test = pd.merge(df_test, df_stores, left_index=True, on='Store')
df_data = pd.merge(df_data, df_stores, left_index=True, on='Store') | No | 5 | 32 | Data_Transform | merge | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 6 | A |
6,331 | df_data['CompetitionDistance'].fillna(df_data['CompetitionDistance'].median(), inplace = True)
df_test['CompetitionDistance'].fillna(df_data['CompetitionDistance'].median(), inplace = True) | No | 5 | 17 | Data_Transform | correct_missing_values | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 3 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 7"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "InPlace Checker"] | 6 | A |
6,332 | max_dist = df_data['CompetitionDistance'].max()
df_data['CompetitionDistance']=df_data['CompetitionDistance']/max_dist
df_test['CompetitionDistance']=df_test['CompetitionDistance']/max_dist | No | 5 | 8 | Data_Transform | feature_engineering | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 6 | A |
6,333 | df_data['PromoInterval'].fillna('n', inplace = True)
df_test['PromoInterval'].fillna('n', inplace = True) | No | 5 | 17 | Data_Transform | correct_missing_values | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 3 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 7"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "InPlace Checker"] | 6 | A |
6,334 | # , 0 1, , <br># <br>print('Days', df_data['DayOfWeek'].unique())<br>print ('Month', df_data['Month'].unique())<br>print ('Promo', df_data['Promo'].unique())<br>print ('StateHoliday', df_data['StateHoliday'].unique())<br>print ('SchoolHoliday', df_data['SchoolHoliday'].unique())<br>print ('StoreType', d... | No | 5 | 57 | Debug | show_unique_values | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,335 | df_data["StateHoliday"].loc[df_data["StateHoliday"] == 0] = "0"
df_test["StateHoliday"].loc[df_test["StateHoliday"] == 0] = "0" | No | 5 | 14 | Data_Transform | filter | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 6 | A |
6,336 | print('StateHoliday', df_data['StateHoliday'].unique()) | No | 5 | 57 | Debug | show_unique_values | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 6 | A |
6,337 | # <br>df_data = df_data[df_data['Sales']!=0] | No | 5 | 14 | Data_Transform | filter | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,338 | df_data = df_data[df_data['Sales']<34500] | No | 5 | 14 | Data_Transform | filter | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 6 | A |
6,339 | df_data.shape | No | 5 | 58 | Debug | show_shape | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,340 | df_data = df_data.drop('Store', axis=1)
df_test = df_test.drop('Store', axis=1) | No | 5 | 10 | Data_Transform | drop_column | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 6 | A |
6,341 | from sklearn.model_selection import train_test_split
df_train, df_mytest = train_test_split(df_data, test_size = 0.2) | No | 5 | 13 | Data_Transform | split | 242,073 | 2 | B | 1 | 0 | 0 | 0 | 5 | 2 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear... | B | Cross Validation Checker=low, Randomness Control Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}] | [] | 6 | B |
6,342 | X_train, y_train = df_train.drop('Sales', axis=1).values, df_train['Sales'].values | No | 5 | 21 | Data_Transform | prepare_x_and_y | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Column Selection Checker"] | 6 | B |
6,343 | from sklearn.linear_model import LinearRegression
model = LinearRegression(n_jobs=4) | No | 5 | 4 | Model_Train | choose_model_class | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 6 | A |
6,344 | model.fit(X_train, y_train) | No | 5 | 7 | Model_Train | train_model | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,345 | # Test Set Predictions
test_proba = clf.predict_proba(test)
test_preds = test_proba[:,1]
test_res=clf.predict(test)
# Format for submission
output = pd.DataFrame({ 'activity_id' : test_ids, 'outcome': test_preds })
output1 = pd.DataFrame({ 'activity_id' : test_ids, 'outcome': test_res })
output.head() | Yes | 4 | 55 | Data_Export | prepare_output | 91,963 | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | ok | 7 | 6 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | B | No random seed setting detected=low | [{"type": "No random seed setting detected", "severity": "low"}] | ["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"] | 5 | B |
6,346 | output.to_csv('redhat.csv', index = False)
output1.to_csv('redhat_noprpba.csv', index = False) | No | 5 | 25 | Data_Export | save_to_csv | 91,963 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 5 | A |
6,347 | import os
import sys
import operator
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory... | Yes | 3 | 8 | Data_Transform | feature_engineering | 242,755 | 1 | A | 0 | 0 | 0 | 0 | 0 | 13 | ok | 1 | 1 | [{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 18"}] | A | no applicable ML-specific findings | [] | ["Hardcoded file path"] | 7 | A |
6,348 | #input data<br>train_df=pd.read_json(\'../input/train.json\')<br>test_df=pd.read_json(\'../input/test.json\')<br>train_df.head()<br>#removing outliers<br><br>test_df["bathrooms"].loc[19671] = 1.5<br>test_df["bathrooms"].loc[22977] = 2.0<br>test_df["bathrooms"].loc[63719] = 2.0<br><br>ulimit = np.percentile(train_df.pri... | Yes | 3 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,349 | def runXGB(train_X, train_y, test_X, test_y=None, feature_names=None, seed_val=321, num_rounds=818):<br> param = {}<br> param[\'objective\'] = \'multi:softprob\'<br> param[\'eta\'] = 0.03<br> param[\'max_depth\'] = 6<br> param[\'silent\'] = 1<br> param[\'num_class\'] = 3<br> param[\'eval_metric\'] ... | No | 3 | 4 | Model_Train | choose_model_class | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,350 | index=list(range(train_df.shape[0]))<br>\t<br>random.shuffle(index)<br>a=[np.nan]*len(train_df)<br>b=[np.nan]*len(train_df)<br>c=[np.nan]*len(train_df)<br><br>for i in range(5):<br> building_level={}<br> for j in train_df['manager_id'].values:<br> building_level[j]=[0,0,0]<br> test_index=index[int((i*tr... | No | 4 | 20 | Data_Transform | categorify | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,351 | a=[]<br>b=[]<br>c=[]<br>building_level={}<br>for j in train_df[\'manager_id\'].values:<br> building_level[j]=[0,0,0]<br>for j in range(train_df.shape[0]):<br> temp=train_df.iloc[j]<br> if temp[\'interest_level\']==\'low\':<br> building_level[temp[\'manager_id\']][0]+=1<br> if temp[\'interest_level\']... | No | 4 | 20 | Data_Transform | categorify | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,352 | for f in categorical:<br>\tif train_df[f].dtype=='object':<br>\t\t#print(f)<br>\t\tlbl = preprocessing.LabelEncoder()<br>\t\tlbl.fit(list(train_df[f].values) + list(test_df[f].values))<br>\t\ttrain_df[f] = lbl.transform(list(train_df[f].values))<br>\t\ttest_df[f] = lbl.transform(list(test_df[f].values))<br>\t\tfeatures... | No | 4 | 20 | Data_Transform | categorify | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,353 | train_df[\'features\'] = train_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br>test_df[\'features\'] = test_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br> | No | 5 | 78 | Data_Transform | string_transform | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,354 | def factorize(df1, df2, column):
ps = df1[column].append(df2[column])
factors = ps.factorize()[0]
df1[column] = factors[:len(df1)]
df2[column] = factors[len(df1):]
return df1, df2
| No | 5 | 20 | Data_Transform | categorify | 242,755 | 1 | A | 0 | 1 | 0 | 0 | 0 | 6 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Missing function docstring"] | 7 | A |
6,355 | for col in ('building_id', 'display_address', 'manager_id', 'street_address'):
train_df,test_df = factorize(train_df, test_df,col)
| No | 5 | 20 | Data_Transform | categorify | 242,755 | 1 | A | 0 | 1 | 1 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
6,356 | X_test, y_mytest = df_mytest.drop('Sales', axis=1).values, df_mytest['Sales'].values | No | 5 | 21 | Data_Transform | prepare_x_and_y | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 6 | A |
6,357 | y_hat = model.predict(X_test) | No | 5 | 48 | Model_Evaluation | predict_on_test | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,358 | from sklearn.linear_model import Ridge | No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 0 | A |
6,359 | R_model = Ridge(alpha=1)
R_model.fit(X_train, y_train) | Yes | 4 | 4 | Model_Train | choose_model_class | 242,073 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 4 | 4 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 6 | B |
6,360 | import os
import sys
import operator
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory... | No | 5 | 88 | Debug | list_files | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 13 | ok | 1 | 1 | [{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 11"}] | A | no applicable ML-specific findings | [] | ["Hardcoded file path"] | 0 | A |
6,361 | #input data<br>train_df=pd.read_json(\'../input/train.json\')<br>test_df=pd.read_json(\'../input/test.json\')<br>train_df.head()<br>#removing outliers<br><br>test_df["bathrooms"].loc[19671] = 1.5<br>test_df["bathrooms"].loc[22977] = 2.0<br>test_df["bathrooms"].loc[63719] = 2.0<br><br>ulimit = np.percentile(train_df.pri... | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,362 | for f in categorical:<br>\tif train_df[f].dtype=='object':<br>\t\t#print(f)<br>\t\tlbl = preprocessing.LabelEncoder()<br>\t\tlbl.fit(list(train_df[f].values) + list(test_df[f].values))<br>\t\ttrain_df[f] = lbl.transform(list(train_df[f].values))<br>\t\ttest_df[f] = lbl.transform(list(test_df[f].values))<br>\t\tfeatures... | No | 5 | 20 | Data_Transform | categorify | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,363 | train_df[\'features\'] = train_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br>test_df[\'features\'] = test_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x])) | No | 5 | 78 | Data_Transform | string_transform | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,364 | print(train_df[features_to_use].head()) | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,365 | train_X = sparse.hstack([train_df[features_to_use], tr_sparse]).tocsr() | No | 5 | 11 | Data_Transform | concatenate | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,366 | test_X = sparse.hstack([test_df[features_to_use], te_sparse]).tocsr() | No | 5 | 11 | Data_Transform | concatenate | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,367 | target_num_map = {'high':0, 'medium':1, 'low':2}
train_y = np.array(train_df['interest_level'].apply(lambda x: target_num_map[x]))
print(train_X.shape, test_X.shape) | Yes | 4 | 21 | Data_Transform | prepare_x_and_y | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,368 | preds, model = runXGB(train_X, train_y, test_X, num_rounds=1000)
out_df = pd.DataFrame(preds)
out_df.columns = ["high", "medium", "low"]
out_df["listing_id"] = test_df.listing_id.values
out_df.to_csv("xgb_starter2.csv", index=False) | Yes | 3 | 48 | Model_Evaluation | predict_on_test | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,369 | data = pd.read_csv('../input/train.csv', sep=',', low_memory=False)
data['StateHoliday'] = data['StateHoliday'].apply(lambda x: str(x)) | Yes | 3 | 45 | Data_Extraction | load_from_csv | 244,626 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path d... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Hardcoded file path"] | 2 | A |
6,370 | grouppedByStoreDayPromo = data[data['Sales'] > 0].groupby(by=['Store', 'DayOfWeek', 'Promo']) | No | 5 | 60 | Data_Transform | groupby | 244,626 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 2 | A |
6,371 | test = pd.read_csv('../input/test.csv', sep=',') | No | 5 | 45 | Data_Extraction | load_from_csv | 244,626 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/test.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 3"}] | A | no applicable ML-specific findings | [] | ["Hardcoded file path"] | 2 | A |
6,372 | mn = data[data['Sales'] > 0].groupby(['Store', 'DayOfWeek', 'Promo'])['Sales'].mean().reset_index() | No | 5 | 60 | Data_Transform | groupby | 244,626 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 2 | A |
6,373 | res[['Id', 'Sales']].to_csv('result_mean.csv', sep=',', index=None) | No | 5 | 25 | Data_Export | save_to_csv | 244,626 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 2 | A |
6,374 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import matplotlib.dates
import datetime
%matplotlib inline | No | 5 | 23 | Environment | set_options | 244,904 | 1 | A | 0 | null | 0 | 0 | 0 | null | invalid_python | 0 | 0 | [] | null | invalid_python | [] | [] | 3 | null |
6,375 | df_train = pd.read_csv("../input/train.csv")
df_store = pd.read_csv("../input/store.csv")
df_test = pd.read_csv("../input/test.csv")
df_train.head() | No | 5 | 45 | Data_Extraction | load_from_csv | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 5 | 3 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."] | 3 | B |
6,376 | closed_store_ids = df_test["Id"][df_test["Open"] == 0].values
closed_store_ids | No | 4 | 41 | Debug | show_table | 244,904 | 1 | A | 0 | 0 | 0 | 1 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
6,377 | df_train['Year'] = df_train['Date'].apply(lambda x: int(x[:4]))
df_train['Month'] = df_train['Date'].apply(lambda x: int(x[5:7]))
df_train['Day'] = df_train['Date'].apply(lambda x: int(x[8:])) | No | 5 | 8 | Data_Transform | feature_engineering | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 3 | 3 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name... | B | Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}] | [] | 3 | B |
6,378 | fig, (axis1) = plt.subplots(1,1,figsize=(15,4))
sns.countplot(x = 'Open', hue = 'DayOfWeek', data = df_train,) | No | 5 | 33 | Visualization | distribution | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,379 | for temp_year in range (2013,2016):<br> df_train1_temp = df_train[df_train.Year == temp_year]<br> average_daily_sales = df_train1_temp.groupby(\'Date\')["Sales"].mean()<br> fig = plt.subplots(1,1,sharex=True,figsize=(25,8))<br> average_daily_sales.plot(title="Average Daily Sales") | No | 5 | 33 | Visualization | distribution | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,380 | average_monthly_sales = df_train.groupby(\'Month\')["Sales"].mean()<br>fig = plt.subplots(1,1,sharex=True,figsize=(10,5))<br>average_monthly_sales.plot(legend=True,marker=\'o\',title="Average Sales") | No | 5 | 33 | Visualization | distribution | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,381 | df_train.StateHoliday.unique() | No | 5 | 57 | Debug | show_unique_values | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,382 | df_train['StateHoliday'] = df_train['StateHoliday'].replace(0, '0')
df_train.StateHoliday.unique() | Yes | 3 | 16 | Data_Transform | data_type_conversions | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,383 | sns.factorplot(x ="Year", y ="Sales", hue ="Promo", data = df_train,
size = 5, kind ="box", palette ="muted")
sns.factorplot(x ="Year", y ="Sales", hue ="SchoolHoliday", data = df_train,
size = 5, kind ="box", palette ="muted")
sns.factorplot(x ="Year", y ="Sales", hue ="HolidayBin... | No | 5 | 75 | Visualization | time_series | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
6,384 | sns.factorplot(x ="Year", y ="Sales", hue ="StateHoliday", data = df_train,
size = 6, kind ="bar", palette ="muted") | No | 5 | 75 | Visualization | time_series | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,385 | sns.factorplot(x ="Month", y ="Sales", hue ="HolidayBin", data = df_train,
size = 6, kind ="bar", palette ="muted") | No | 5 | 75 | Visualization | time_series | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,386 | sns.factorplot(x="DayOfWeek", y="Customers", hue="HolidayBin", col="Promo", data=df_train,
capsize=.2, palette="YlGnBu_d", size=6, aspect=.75) | No | 5 | 75 | Visualization | time_series | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,387 | sns.factorplot(x="DayOfWeek", y="Customers", hue="SchoolHoliday", col="Promo", data=df_train,
capsize=.2, palette="YlGnBu_d", size=6, aspect=.75) | No | 5 | 75 | Visualization | time_series | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,388 | sns.distplot(df_train.Sales) | No | 5 | 33 | Visualization | distribution | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
6,389 | df_store.head() | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,390 | total_sales_customers = df_train.groupby('Store')['Sales', 'Customers'].sum()
total_sales_customers.head() | Yes | 3 | 60 | Data_Transform | groupby | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,391 | df_total_sales_customers = pd.DataFrame({'Sales': total_sales_customers['Sales'],
'Customers': total_sales_customers['Customers']},
index = total_sales_customers.index)
df_total_sales_customers = df_total_sales_customers.reset_index()
... | Yes | 3 | 12 | Data_Transform | create_dataframe | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,392 | avg_sales_customers = df_train.groupby('Store')['Sales', 'Customers'].mean()
avg_sales_customers.head() | Yes | 4 | 60 | Data_Transform | groupby | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,393 | df_avg_sales_customers = pd.DataFrame({'Sales': avg_sales_customers['Sales'],
'Customers': avg_sales_customers['Customers']},
index = avg_sales_customers.index)
df_avg_sales_customers = df_avg_sales_customers.reset_index()
df_stores_a... | Yes | 3 | 12 | Data_Transform | create_dataframe | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,394 | df_stores_new = df_total_sales_customers.join(df_store.set_index('Store'), on='Store')
df_stores_new.head() | Yes | 4 | 32 | Data_Transform | merge | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,395 | average_storetype = df_stores_new.groupby('StoreType')['Sales', 'Customers', 'CompetitionDistance'].mean()
fig, (axis1,axis2,axis3) = plt.subplots(1,3,figsize=(15,4))
sns.barplot(average_storetype.index, average_storetype['Sales'], ax=axis1)
sns.barplot(average_storetype.index, average_storetype['Customers'], ax=axis2... | Yes | 4 | 33 | Visualization | distribution | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
6,396 | average_assortment = df_stores_new.groupby('Assortment')['Sales', 'Customers'].mean()
fig, (axis1,axis2) = plt.subplots(1,2,figsize=(15,4))
sns.barplot(average_assortment.index, average_assortment['Sales'], ax=axis1)
sns.barplot(average_assortment.index, average_assortment['Customers'], ax=axis2) | Yes | 4 | 33 | Visualization | distribution | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,397 | df_test[\'Year\'] = df_test[\'Date\'].apply(lambda x: int(x[:4]))<br>df_test[\'Month\'] = df_test[\'Date\'].apply(lambda x: int(x[5:7]))<br>df_test[\'Day\'] = df_test[\'Date\'].apply(lambda x: int(x[8:]))<br>df_test["HolidayBin"] = df_test.StateHoliday.map({"0": 0, "a": 1, "b": 1, "c": 1})<br>del df_test[\'Date\']<br>d... | Yes | 3 | 16 | Data_Transform | data_type_conversions | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,398 | df_train.head() | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,399 | from sklearn.linear_model import LinearRegression
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import GridSearchCV
train_stores = dict(list(df_train.groupby('Store')))
test_stores = dict(list(df_test.groupby('Store'))) | Yes | 4 | 22 | Environment | import_modules | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}] | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | [] | 3 | B |
6,400 | best_list_max_depth = []<br>best_list_n_estimators = []<br><br>for i in test_stores:<br> store = train_stores[i]<br> X_train = store.drop(["Sales", "Store", "Customers"],axis=1)<br> Y_train = store["Sales"]<br> X_test = test_stores[i].copy()<br><br> <br> store_ids = X_test["Id"]<br> X_test.drop(["... | Yes | 4 | 2 | Hyperparam_Tuning | find_best_params | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,401 | res_max_depth = round(np.array(best_list_max_depth).mean())
res_n_estimators = round(np.array(best_list_n_estimators).mean()) | No | 5 | 2 | Hyperparam_Tuning | find_best_params | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
6,402 | best_max_depth = round(np.array(best_list_max_depth).mean())
best_n_estimators = round(np.array(best_list_n_estimators).mean())
print(best_max_depth)
print(best_n_estimators) | No | 5 | 2 | Hyperparam_Tuning | find_best_params | 244,904 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.