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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7,928 | pred_lbls = []
for pred in predictions:
pred = list(pred)
max_value = max(pred)
max_index = pred.index(max_value)
pred_lbls.append(max_index)
predictions = np.array(pred_lbls) | No | 5 | 55 | Data_Export | prepare_output | null | 1 | A | 0 | 1 | 1 | 0 | 0 | 7 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,929 | predictions.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 |
7,930 | test['president_id'] = predictions | No | 5 | 8 | Data_Transform | feature_engineering | 2,297,927 | 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"] | 7 | A |
7,931 | test['president_id'].value_counts() | No | 5 | 72 | EDA | count_values | 2,297,927 | 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"] | 7 | A |
7,932 | submission = test[['sentence_id','president_id']]
submission.columns = ['sentence', 'president']
submission.to_csv('rnn_1.csv', index=False) | No | 5 | 25 | Data_Export | save_to_csv | 2,297,927 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
7,933 | submission.president.value_counts() | No | 5 | 72 | EDA | count_values | 2,297,927 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
7,934 | #Dataframes etc
import pandas as pd
import numpy as np
#Visualization
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
from matplotlib.colors import ListedColormap
from pylab import rcParams
rcParams['figure.figsize'] = 10, 8
sns.set_style('whitegrid')
#Machine learning:
from sklearn import p... | No | 5 | 23 | Environment | set_options | null | 1 | A | 0 | null | 0 | 0 | 0 | null | invalid_python | 0 | 0 | [] | null | invalid_python | [] | [] | 0 | null |
7,935 | df=pd.read_csv('../input/train.csv')
df.head()
| Yes | 4 | 45 | Data_Extraction | load_from_csv | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,936 | df['president'].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 |
7,937 | df.info()
#no nulls, nothing unexpected | No | 5 | 40 | Debug | show_table_attributes | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,938 |
dict = {'deKlerk': 0,
'Mandela': 1,
'Mbeki': 2,
'Motlanthe': 3,
'Zuma': 4,
'Ramaphosa': 5}
| No | 5 | 77 | Other | define_variables | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,939 | df['presi_num']= df['president']
df['presi_num']=df['presi_num'].replace(dict)
df.head() | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,940 | df['speech length']=df['text'].str.len()
df.head() | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,941 | df_summary = pd.DataFrame(df.groupby('president')['speech length'].mean())
df_summary=df_summary.reset_index()
df_summary = df_summary.sort_values(by='speech length')
sns.barplot(data = df_summary, x='president', y='speech length') | No | 5 | 33 | Visualization | distribution | null | 1 | A | 1 | 0 | 0 | 0 | 6 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,942 | df_summary['speech_length_%']=df_summary['speech length'].div(df_summary['speech length'].sum(), axis=0).multiply(100)
df_summary.head() | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,943 | list(df_summary['speech_length_%']) | 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 |
7,944 | df_summary['presi_num']= df_summary['president']
df_summary['presi_num']= df_summary['presi_num'].replace(dict)
df_summary.sort_values(by='presi_num', ascending = True)
df_summary | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | 0 | 0 | 1 | 0 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
7,945 | #check
list(df_summary['presi_num']) | 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 |
7,946 | import string
def remove_punctuation_numbers(post):
punc_numbers = string.punctuation + '0123456789'
return ''.join([l for l in post if l not in punc_numbers])
| No | 5 | 78 | Data_Transform | string_transform | null | 1 | A | 0 | 2 | 0 | 0 | 0 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
77 | # from sklearn.model_selection import GridSearchCV\n# from xgboost import XGBRegressor\n\n# y_Train = X_Train.ConfirmedCases\n# hyperParam = {\ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
113 | \ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
120 | #print (type(Y_train_CC))\n#X_train_CC.info() | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
134 | #print (X_train_CC.shape, X_train_Fat.shape, X_test.shape) | No | 5 | 76 | Debug | commented | 8,660,923 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 11 | A |
181 | #TODO: check duplicates,missing numeric, string, typo. | No | 5 | 76 | Debug | commented | null | 1 | A | 1 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
465 | #cols_with_missing = [col for col in X_train.columns \n# if X_train[col].isnull().any()]\n#X_train = X_train.drop(cols_with_missing, axis=1)\n#X_test = X_test.drop(cols_with_missing, axis=1) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
470 | #NO NULL | No | 5 | 76 | Debug | commented | 6,470,191 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
500 | #gbr = GradientBoostingRegressor(random_state=17) | No | 5 | 76 | Debug | commented | 8,382,140 | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 6 | A |
615 | # \n\n# df_train.isna().sum()\n# df_test.isna().sum()\n\n# | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
616 | # \n\n# pd.DataFrame(df_train).dtypes | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
623 | #dftrain.groupby('City')['revenue'].agg(['count','mean']) | No | 5 | 76 | Debug | commented | 6,470,191 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
624 | #P1 int testset has no 7,8,10,11,13,14,16 values skew 1.8\n#P2 FLOAT skew 0.03 test set only few decima values between 1 and 2, 4 and 5, \n#P3 float skew 0.14 test set only some decimal values between 4 and 5\n#P10 int64 skew 1.70 test set 80% values are 5, 15% values are 10, test set exactly like train set.\n#P22 int6... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
625 | #no log transform = P2, P3, P7, | No | 5 | 76 | Debug | commented | 6,470,191 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
627 | #for col in dftrain.columns:\n # if (dftrain[col].dtype == int) | (dftrain[col].dtype == float):\n # print (col)\n # print (skew(dftrain[col]))\n # print (skew(np.log1p(dftrain[col]))) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
701 | # import pandas_profiling as pdp\n# pdp.ProfileReport(train) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
719 | # city_rev = []\n\n# for i in train['City']:\n# for key, value in mean_dict.items():\n# if i == key:\n# city_rev.append(value)\n \n# df_city_rev = pd.DataFrame({'city_rev':city_rev})\n# train = pd.concat([train,df_city_rev],axis=1)\n# train.head() | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
720 | # train.replace({"City":mean_dict}, inplace=True)\n# test.replace({"City":mean_dict}, inplace=True)\n# test[\ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
735 | # train.iloc[list(tukey_outliers(df_num.acceleration).index)] | No | 5 | 76 | Debug | commented | 12,034,947 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 18 | A |
737 | # \n# for i in range(len(num_list)):\n# # \n# upper_lim = full_data[num_list[i]].quantile(.95)\n# lower_lim = full_data[num_list[i]].quantile(.05)\n \n# # IQR\n# Q1 = full_data[num_list[i]].quantile(.25)\n# Q3 = full_data[num_list[i]].quantile(.75)\n# IQR = Q3 - Q1\n# outlier_step = ... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
738 | # columns = len(num_list)/4+1\n\n# # boxplot\n# fig = plt.figure(figsize=(15,20))\n# plt.subplots_adjust(hspace=0.2, wspace=0.8)\n# for i in range(len(num_list)):\n# ax = fig.add_subplot(columns, 4, i+1)\n# sns.boxplot(y=full_data[num_list[i]], data=full_data, ax=ax)\n# plt.show() | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
740 | # skew_col = skewed_data[skewed_data > 10].index\n\n# # \n# fig = plt.figure(figsize=(10, 8))\n# for i in range(len(skew_col)):\n# ax = fig.add_subplot(2, 3, i+1)\n# try:\n# sns.distplot(combined_df[skew_col[i]], fit=norm, ax=ax)\n# except:\n# # kdekde=False\n# sns.distplot(combined_... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
754 | # #LightGBM\n# import lightgbm as lgb\n# #\n# import optuna\n\n# lgb_train = lgb.Dataset(X_train, y_train)\n# lgb_eval = lgb.Dataset(X_test, y_test) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
755 | # def objective(trial):\n# params = {'metric': {'rmse'},\n# 'max_depth' : trial.suggest_int('max_depth', 1, 10),\n# 'subsumple' : trial.suggest_uniform('subsumple', 0.0, 1.0),\n# 'subsample_freq' : trial.suggest_int('subsample_freq', 0, 1),\n# 'leaning_rate' :... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
756 | # study = optuna.create_study()\n# study.optimize(objective, timeout=360) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
757 | # print(\ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
758 | \n# #Optuna\n# params = {"metric": {\ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
759 | # #\n# lgb.plot_importance(gbm, height=0.5, figsize=(8,16)) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
760 | # \n# prediction_log = gbm.predict(test_X)\n# print(prediction_log)\n# prediction =np.exp(prediction_log) \n# print(prediction) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
777 | # cap revenue at 10,000,000 for outliers\n# df.loc[df['revenue'] > 10000000, 'revenue'] = 10000000 | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
892 | # train_profile = ProfileReport(train, title='Pandas Profiling Report', html={'style':{'full_width':True}})\n# train_profile | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
893 | # test_profile = ProfileReport(test, title='Pandas Profiling Report', html={'style':{'full_width':True}})\n# test_profile | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
907 | # date_encoded = {}\n# for s in train[\ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
908 | # train['date_encoded'] = train['Date'].apply(lambda x: date_encoded[x])\n# train['date_encoded'] = (train['date_encoded'] - train['date_encoded'].mean()) / train['date_encoded'].std()\n# train.head() | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,009 | #INVERSE TRANSFORM\n#pred_f = pred_f*scale | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,016 | #result.set_index('ForecastId', inplace=True) | No | 5 | 76 | Debug | commented | 8,620,454 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | 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"] | 14 | A |
1,021 | #result= result[['ConfirmedCases','Fatalities']].round(0) | No | 5 | 76 | Debug | commented | 8,620,454 | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | 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"] | 14 | A |
1,029 | #submission['ConfirmedCases'] = [0 if submission.loc[i, 'ConfirmedCases'] <= -0 \n # else submission.loc[i, 'ConfirmedCases'] for i in submission.index] | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,100 | '''train = df_train.values\nX_train, y_train = train[:,:-2], train[:,-2:]''' | No | 5 | 76 | Debug | commented | null | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,106 | '''model1 = XGBRegressor(\n learning_rate =0.1,\n n_estimators=1000,\n max_depth=5,\n min_child_weight=1,\n gamma=0,\n subsample=0.8,\n colsample_bytree=0.8,\n objective= 'reg:squarederror',\n scale_pos_weight=1)\nmodelfit(model1, X_train, y_train[:,0])''' | No | 5 | 76 | Debug | commented | null | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,108 | '''model2 = XGBRegressor(\n learning_rate =0.1,\n n_estimators=1000,\n max_depth=5,\n min_child_weight=1,\n gamma=0,\n subsample=0.8,\n colsample_bytree=0.8,\n objective= 'reg:squarederror',\n scale_pos_weight=1)\nmodelfit(model2, X_train, y_train[:,1])''' | No | 5 | 76 | Debug | commented | null | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,126 | '''df_submit.ConfirmedCases = df_submit.ConfirmedCases.apply(lambda x:max(0,round(x,0)))\ndf_submit.Fatalities = df_submit.Fatalities.apply(lambda x:max(0,round(x,0)))''' | No | 5 | 76 | Debug | commented | null | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,173 | #?TabularPandas | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,278 | # estimators = [('rf',RF_model ), ('ada', adaboost_model_for_ConfirmedCases)]\n# stacking_model_for_ConfirmedCases = StackingClassifier(estimators=estimators, n_jobs=4)\n# stacking_model_for_ConfirmedCases.fit(train_numeric_X, train_numeric_Y[numeric_features_Y[0]]) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,279 | # stacking_model_for_Fatalities = StackingClassifier(estimators=estimators, n_jobs=4)\n# stacking_model_for_Fatalities.fit(train_numeric_X, train_numeric_Y[numeric_features_Y[1]]) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,280 | # predicted = stacking_model_for_ConfirmedCases.predict(test_numeric_X)\n# predicted2 = stacking_model_for_Fatalities.predict(test_numeric_X)\n\n# submission = np.vstack((test['ForecastId'], predicted,predicted2)).T\n# submission = submission.astype(np.int32)\n\n# df = pd.DataFrame(data=submission, columns=['ForecastId... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,281 | # from sklearn.neighbors import KNeighborsClassifier\n# from sklearn.naive_bayes import GaussianNB \n# from sklearn.linear_model import LogisticRegression\n# from sklearn import model_selection\n# from mlxtend.classifier import StackingCVClassifier | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,282 | # clf1 = KNeighborsClassifier(n_neighbors=100)\n# clf2 = RandomForestClassifier(n_estimators=5)\n# clf3 = GaussianNB()\n# # Logit will be used for stacking\n# lr = LogisticRegression(solver=\ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,530 | # Tried adding spaCy coref as a feature. I have no expertise with this library.\n# It seems to work in many cases, but for some cases the coref resolves to just \n# he/she/etc rather than a noun. Not sure if it is because the coref model is \n# not confident, I'm navigating the object model incorrectly, or just a limit... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
1,942 | #os.system(f'ls {mf}1') | No | 5 | 76 | Debug | commented | 3,663,832 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
1,985 | #fig, (axis1) = plt.subplots(1,1,figsize=(8,3))\n#sns.countplot(x = 'Open', hue = 'DayOfWeek', data = data_train,) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,009 | #sns.factorplot(x ="Year", y ="Sales", hue ="Promo", data = data_train, size = 3, kind ="box", palette ="muted") | No | 5 | 76 | Debug | commented | 244,962 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
2,010 | #sns.factorplot(x ="Year", y ="Sales", hue ="SchoolHoliday", data = data_train, size = 3, kind ="box", palette ="muted") | No | 5 | 76 | Debug | commented | 244,962 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
2,012 | #sns.factorplot(x ="Year", y ="Sales", hue ="HolidayBin", data = data_train, size = 4, kind ="bar", palette ="muted") | No | 5 | 76 | Debug | commented | 244,962 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
2,037 | #fig, (axis1, axis2, axis3) = plt.subplots(1, 3, figsize=(12,3))\n#sns.barplot(average_store_type.index, average_store_type['Sales'], ax=axis1)\n#sns.barplot(average_store_type.index, average_store_type['Customers'], ax=axis2)\n#sns.barplot(average_store_type.index, average_store_type['CompetitionDistance'], ax=axis3) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,042 | #fig, (axis1,axis2) = plt.subplots(1,2,figsize=(12,3))\n#sns.barplot(average_assort.index, average_assort['Sales'], ax=axis1)\n#ns.barplot(average_assort.index, average_assort['Customers'], ax=axis2) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,054 | # ( )\n# res_list_depth = []\n# res_list_nestim = []\n# for i in range (1, 1000, 50):\n# store_part = train_stores[i]\n# X_train_part = store_part.drop(["Sales", "Store", "Customers"],axis=1)\n# Y_train_part = store_part["Sales"]\n# X_train_part = X_train_part.fillna(X_train_part.mean())\n# est... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,056 | # : 0.14930 - pub, 0.13491 - priv | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,172 | #df_store[pd.isnull(df_store.Promo2SinceWeek)]\n#df_store[pd.isnull(df_store.Promo2SinceWeek)& (df_store.Promo2==0)] | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,222 | #!kaggle competitions submit -c rossmann-store-sales -f rossmann_submission.csv -m "rossman with extra features" | No | 5 | 76 | Debug | commented | 2,568,883 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 2 | A |
2,269 | #train_sales = np.log(train_sales) | No | 5 | 76 | Debug | commented | 3,237,641 | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 2 | A |
2,273 | #preds = np.exp(predictions) | No | 5 | 76 | Debug | commented | 3,237,641 | 1 | A | 1 | 0 | 0 | 0 | 5 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 2 | A |
2,280 | \n#df_train_store[['StateHoliday', 'StoreType', 'Assortment']] = df_train_store[['StateHoliday', 'StoreType', 'Assortment']].apply(lambda x: x.cat.codes) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,324 | #This is the best combination i got from what i propose to try out with a (mse) score of 0.855 which is quite good\n#grid.best_params_,grid.best_score_\n#MY BEST PARAMS ARE :n_estimators=128,max_depth=20,min_samples_split=10 | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,342 | # now using Xgb | No | 5 | 76 | Debug | commented | 4,029,935 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 16 | A |
2,348 | #X_train, X_valid, y_train, y_valid = train_test_split(x_train, y, train_size=0.8, test_size=0.2,\n # random_state=0) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,431 | # store_rows[store_rows['Sales']==0] | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,435 | # store.isna.sum() | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,441 | # Decision tress - label encoding should be used.\n# regression - one hot encoding must be used. | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,452 | # submitting the train on test data set | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,494 | \n# parameters={'max_depth':list(range(5,20))}\n# base_model=DTR()\n# cv_model=GridSearchCV(base_model,param_grid=parameters,cv=5,return_train_score=True).fit(X_train,y_train)\n | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,495 | # cv_model.best_params_ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,496 | # cv_results_1=pd.DataFrame(cv_model.cv_results_).sort_values(by='mean_test_score',ascending=False)\n# cv_results=pd.DataFrame(cv_model.cv_results_).sort_values(by='mean_test_score',ascending=False)\n# cv_results_1.set_index('param_max_depth')['mean_test_score'].plot.line()\n# cv_results_1.set_index('param_max_depth')[... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,497 | #!pip install pydotplus | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,498 | # def draw_tree(model, columns):\n# import pydotplus\n# from sklearn.externals.six import StringIO\n# from IPython.display import Image\n# import os\n# from sklearn import tree\n \n# graphviz_path = \ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,499 | # draw_tree(model_dtr,data_merged.columns.drop(['Sales','Date'])) | No | 5 | 76 | Debug | commented | 6,511,403 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
2,541 | #df['Date'].dt.strftime('%a') | No | 5 | 76 | Debug | commented | 6,511,492 | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
2,632 | # from sklearn.model_selection import GridSearchCV\n\n# parameters={'max_depth':list(range(5,20))} # parmeters{'max_depth':list(range(5,20),'min_sample_split':[5,10,20])}\n# base_model=DecisionTreeRegressor()\n# cv_model=GridSearchCV(base_model,param_grid=parameters,cv=5,return_train_score=True).fit(train_x,train_y) | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,633 | # df_cv_results=pd.DataFrame(cv_model.cv_results_).sort_values(by='mean_test_score',ascending=False)[['param_max_depth','mean_test_score','mean_train_score']]\n# plt.figure(figsize=(10,5))\n# df_cv_results.set_index('param_max_depth')['mean_test_score'].plot.line()\n# df_cv_results.set_index('param_max_depth')['mean_tr... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,671 | # learn.fit_one_cycle(5, 5e-4, wd=0.1)\n# learn.recorder.plot_losses() | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,674 | # #colab\n# # google-drive-ocamlfuse\n# # https://github.com/astrada/google-drive-ocamlfuse\n# !apt-get install -y -qq software-properties-common python-software-properties module-init-tools\n# !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null\n# !apt-get update -qq 2>&1 > /dev/null\n# !apt-get -y insta... | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
2,675 | # !pip install kaggle\n# !echo \ | No | 5 | 76 | Debug | commented | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.