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,863 | cm = confusion_matrix(y, valid_preds)
plot_confusion_matrix(cm, data.classes) | No | 5 | 56 | Visualization | plot_predictions | 1,443,020 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 2 | A |
6,866 | ans.to_csv('submission.csv', index=False) | No | 5 | 25 | Data_Export | save_to_csv | 1,443,020 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 2 | A |
6,867 | from sklearn import pipeline,ensemble,preprocessing, feature_extraction
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score
from collections import Counter
from sklearn.svm import LinearSVC
from sk... | No | 5 | 22 | Environment | import_modules | null | 1 | A | 1 | 0 | 0 | 0 | 5 | 7 | 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"] | 0 | A |
6,868 | train = pd.read_json('../input/train.json') | No | 5 | 44 | Data_Extraction | load_from_disk | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,869 | %matplotlib inline | No | 4 | 23 | Environment | set_options | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,870 | import matplotlib.pyplot as plt
plt.style.use('ggplot') | Yes | 3 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,871 | train['cuisine'].value_counts().plot(kind='bar') | No | 5 | 33 | Visualization | distribution | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,872 | top10= pd.DataFrame([[items[0] for items in counters[cuisine].most_common(10)] for cuisine in counters],
index=[cuisine for cuisine in counters],
columns=['top{}'.format(i) for i in range(1,11)])
top10 | No | 4 | 12 | Data_Transform | create_dataframe | null | 1 | A | 1 | 0 | 0 | 1 | 5 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,873 | indices=train.ingredients.str.contains('garlic cloves')
train[indices]['cuisine'].value_counts().plot(kind='bar',
title= 'Dientes de ajo hallados por cocina') | No | 5 | 33 | Visualization | distribution | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,874 | unique= np.unique(top10.values.ravel())
unique
fig, axes= plt.subplots(8,8, figsize=(20,20))
for ingredient, ax_index in zip(unique, range(64)):
indices=train.ingredients.str.contains(ingredient)
relative_freq= (train[indices]['cuisine'].value_counts()/train['cuisine'].value_counts())
relative_freq.plot(kin... | No | 5 | 33 | Visualization | distribution | null | 1 | A | 0 | 1 | 1 | 1 | 0 | 7 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,875 | train.isnull().sum() | No | 5 | 39 | EDA | count_missing_values | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,876 | fig,axes=plt.subplots(nrows=2,ncols=2)
sn.boxplot(data=train,y='count',orient='v',ax=axes[0][0])
sn.boxplot(data=train,y='count',x='season',orient='v',ax=axes[0][1])
sn.boxplot(data=train,y='count',x='hour',orient='v',ax=axes[1][0])
sn.boxplot(data=train,y='count',x='workingday',orient='v',ax=axes[1][1]) | No | 5 | 33 | Visualization | distribution | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | 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 |
6,877 | trainwo=train[np.abs(train['count']-train['count'].mean())<=3*train['count'].std()] | No | 5 | 14 | Data_Transform | filter | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 4 | 4 | [{"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, 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"}] | ["Column Selection Checker"] | 7 | B |
6,878 | print('Shape of the DataFrame with outliers: ', train.shape)
print('Shape of the DataFrame without outliers: ', trainwo.shape) | No | 5 | 58 | Debug | show_shape | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
6,879 | corr=train[["temp","atemp","casual","registered","humidity","windspeed","count"]].corr()
mask=np.array(corr)
mask[np.tril_indices_from(mask)]=False
fig,ax=plt.subplots()
sn.heatmap(corr,mask=mask,vmax=.8,square=True,annot=True) | Yes | 4 | 80 | Visualization | heatmap | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "NumPy", "name": "Array Creation Efficiency", "fix": "Specify dtype when creating arrays.", "benefits": "Improves memory efficiency and avoids unnecessary conversions.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross ... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Array Creation Efficiency"] | 7 | B |
6,880 | clf=pipeline.Pipeline([
('tfidf_vectorizer', feature_extraction.text.TfidfVectorizer(lowercase=True)),
('clf', LinearSVC(random_state=0))
]) | Yes | 3 | 4 | Model_Train | choose_model_class | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,881 | # step 1: testing
X_train,X_test,y_train,y_test=train_test_split(train.ingredients,train.cuisine, test_size=0.2) | No | 5 | 13 | Data_Transform | split | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,882 | clf.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,883 | y_pred = clf.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,884 | confusion_matrix(y_test, y_pred) | No | 5 | 49 | Model_Evaluation | compute_test_metric | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,885 | accuracy_score(y_test, y_pred) | No | 5 | 49 | Model_Evaluation | compute_test_metric | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,886 | # step 2: real training
test=pd.read_json('../input/test.json') | No | 5 | 44 | Data_Extraction | load_from_disk | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,887 | test.ingredients=test.ingredients.apply(' '.join) | No | 5 | 78 | Data_Transform | string_transform | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,888 | clf.fit(train.ingredients,train.cuisine) | 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,889 | pred=clf.predict(test.ingredients) | 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,890 | df=pd.DataFrame({'id':test.id,'cuisine':pred}) | 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,891 | df.to_csv('LinearSVC.csv', columns=['id','cuisine'],index=False) | No | 5 | 25 | Data_Export | save_to_csv | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,892 | # This Python 3 environment comes with many helpful analytics libraries installed<br># It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python<br># For example, here\'s several helpful packages to load in <br><br>import numpy as np # linear algebra<br>import pandas as pd # data processi... | No | 5 | 88 | Debug | list_files | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,893 | from matplotlib import pyplot as plt
import seaborn as sns
sns.set()
%matplotlib inline
%config InlineBackend.figure_format = 'retina' | No | 5 | 23 | Environment | set_options | 1,460,440 | 1 | A | 0 | null | 0 | 0 | 0 | null | invalid_python | 0 | 0 | [] | null | invalid_python | [] | [] | 5 | null |
6,894 | df_store = pd.read_csv('../input/store.csv')
df = pd.read_csv('../input/train.csv', low_memory=False)
df = df.merge(df_store, on='Store') | Yes | 4 | 45 | Data_Extraction | load_from_csv | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 3 | 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."] | 5 | A |
6,895 | df_test = pd.read_csv('../input/test.csv', low_memory=False)
df_test.head() | Yes | 4 | 45 | Data_Extraction | load_from_csv | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | 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 6"}] | A | no applicable ML-specific findings | [] | ["Hardcoded file path"] | 5 | A |
6,896 | df.head(5) | 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,897 | df['Date'] = pd.to_datetime(df['Date'])
df['Month'] = df.Date.apply(lambda dt: dt.month)
df['Year'] = df.Date.apply(lambda dt: dt.year)
df['WeekOfYear'] = df.Date.apply(lambda dt: dt.weekofyear)
df['Day'] = df.Date.apply(lambda dt: dt.day)
df['isMonthEnd'] = df.Date.apply(lambda dt: dt.is_month_end)
df['isMonthStart']... | No | 5 | 8 | Data_Transform | feature_engineering | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 11 | 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,898 | features = []
for feat in df.columns.drop('Sales'):
if df[feat].dtype == np.float64 or df[feat].dtype == np.int64:
features.append(feat) | No | 5 | 77 | Other | define_variables | 1,460,440 | 1 | A | 0 | 3 | 4 | 0 | 0 | 4 | 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,899 | fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(20, 20));
df_sample = df.sample(frac=0.05)
for idx, feature in enumerate(features):
df_sample.plot(feature, "Sales", subplots=True, kind="scatter", ax=axes[idx // 4, idx % 4]); | No | 5 | 33 | Visualization | distribution | 1,460,440 | 1 | A | 0 | 1 | 1 | 0 | 0 | 4 | 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,900 | # Customers Sales ( Open/Promo). - <br># Promo2 <br><br>df[df.columns.drop('Sales')].corrwith(df.Sales) | No | 5 | 40 | Debug | show_table_attributes | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,901 | # "b" <br><br>df.groupby(\'StoreType\')[\'Sales\'].mean() | No | 5 | 60 | Data_Transform | groupby | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,902 | sns.distplot(df.Sales[df.Sales > 0]) | No | 5 | 33 | Visualization | distribution | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 5 | A |
6,903 | df.info() | 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 |
6,904 | # Promo2, ~SinceWeek ~SinceYear<br>df[(pd.isnull(df.Promo2SinceWeek) | pd.isnull(df.Promo2SinceYear)) & df.Promo2 != 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,905 | df['CompetitionOpenSinceMonth'].fillna(0, inplace=True)
df['CompetitionOpenSinceYear'].fillna(0, inplace=True) | No | 5 | 17 | Data_Transform | correct_missing_values | 1,460,440 | 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 6"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "InPlace Checker"] | 5 | A |
6,906 | df['Promo2SinceWeek'].fillna(0, inplace=True)
df['Promo2SinceYear'].fillna(0, inplace=True) | No | 5 | 17 | Data_Transform | correct_missing_values | 1,460,440 | 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 6"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "InPlace Checker"] | 5 | A |
6,907 | df['CompetitionDistance'].fillna(df['CompetitionDistance'].median(), inplace=True)
df['CompetitionDistance'] = np.log(df.CompetitionDistance) + 1 | Yes | 4 | 17 | Data_Transform | correct_missing_values | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 2 | 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 6"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker",... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "InPlace Checker"] | 5 | A |
6,908 | df.sample(frac=.001).plot(\'CompetitionDistance\', "Sales", subplots=True, kind="scatter") | 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,909 | # , <br>df.groupby('Store')['CompetitionDistance'].unique().apply(lambda l: 1 if len(l) > 1 else 0).sum() | No | 5 | 60 | Data_Transform | groupby | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,910 | # , <br>df['StateHoliday'] = df['StateHoliday'].replace(0, '0')<br>df['Holiday'] = df.StateHoliday.apply(lambda x: 0 if x == '0' else 1)<br><br>df.drop('StateHoliday', axis=1, inplace=True) | 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,911 | df = df.sort_values(by='Date')
df.drop('Date', axis=1, inplace=True) | Yes | 3 | 9 | Data_Transform | sort_values | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 1 | 1 | [{"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"}] | A | no applicable ML-specific findings | [] | ["InPlace Checker"] | 5 | A |
6,912 | df = df[(df['Open'] != 0) & (df['Sales'] != 0)]
df.drop('Open', axis=1, inplace=True) | Yes | 3 | 14 | Data_Transform | filter | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 2 | 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": "Column Selection Checker",... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "InPlace Checker"] | 5 | A |
6,913 | # <br><br>df.PromoInterval.value_counts() | No | 5 | 72 | EDA | count_values | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,914 | df['isMonthEnd'] = df['isMonthEnd'].astype(int)
df['isMonthStart'] = df['isMonthStart'].astype(int)
df['isQuarterEnd'] = df['isQuarterEnd'].astype(int)
df['isQuarterStart'] = df['isQuarterStart'].astype(int)
df['isYearEnd'] = df['isYearEnd'].astype(int)
df['isYearStart'] = df['isYearStart'].astype(int) | No | 5 | 16 | Data_Transform | data_type_conversions | 1,460,440 | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | 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,915 | # competition open time (in months)<br>df['CompetitionOpen'] = 12 * (df.Year - df.CompetitionOpenSinceYear) + \\<br> (df.Month - df.CompetitionOpenSinceMonth)<br> <br># Promo open time<br>df['PromoOpen'] = 12 * (df.Year - df.Promo2SinceYear) + \\<br> (df.WeekOfYear - df.Promo2SinceWeek) / 4.0<br><br>df... | 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,917 | import xgboost as xgb<br>from hyperopt import hp<br>from hyperopt import fmin, tpe, hp, STATUS_OK, Trials<br><br>def train(index, train, hp_selection=False):<br> train_store = train[index]<br> X = train_store[train_store.columns.drop([\'Sales\', \'Store\', \'Customers\'])]<br> y = train_store[\'Sales\']<br><br... | Yes | 2 | 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,921 | df_test = pd.read_csv(\'../input/test.csv\', low_memory=False)<br>closed_store_ids = df_test["Id"][df_test["Open"] == 0].values<br><br>df_test = df_test.merge(df_store, on=\'Store\')<br>df_test[\'Date\'] = pd.to_datetime(df_test[\'Date\'])<br>df_test[\'Month\'] = df_test.Date.apply(lambda dt: dt.month)<br>df_test[\'Yea... | Yes | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,922 | fig,(ax1,ax2,ax3)=plt.subplots(ncols=3)
sn.regplot(x='temp',y='count',data=train,ax=ax1)
sn.regplot(x='windspeed',y='count',data=train,ax=ax2)
sn.regplot(x='humidity',y='count',data=train,ax=ax3) | No | 5 | 33 | Visualization | distribution | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
6,923 | train=pd.read_csv(\'../input/train.csv\')<br>test=pd.read_csv("../input/test.csv") | No | 5 | 45 | Data_Extraction | load_from_csv | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,924 | data=train.append(test)
data.reset_index(inplace=True)
data.drop('index',inplace=True,axis=1)
| Yes | 4 | 10 | Data_Transform | drop_column | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 2 | 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 10"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Che... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["InPlace Checker"] | 7 | B |
6,925 | data[\'date\']=data[\'datetime\'].apply(lambda x:x.split()[0])<br>data[\'hour\']=data[\'datetime\'].apply(lambda x:x.split()[1].split(\':\')[0])<br>data[\'year\']=data[\'date\'].apply(lambda x:x.split(\'-\')[0])<br>data[\'month\']=data[\'date\'].apply(lambda x:datetime.strptime(x,"%Y-%m-%d").month)<br>data[\'weekday\']... | No | 5 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,926 | from sklearn.ensemble import RandomForestRegressor
wind0=data[data['windspeed']==0]
windNot0=data[data['windspeed']!=0]
rf_wind=RandomForestRegressor()
wind_cols=['season','weather','year','month','temp','atemp','humidity']
rf_wind.fit(windNot0[wind_cols],windNot0['windspeed'])
pred=rf_wind.predict(X=wind0[wind_cols])
... | Yes | 2 | 7 | Model_Train | train_model | 1,318,352 | 1 | A | 2 | 0 | 0 | 0 | 10 | 11 | ok | 12 | 10 | [{"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 18"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker"... | B | Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low, Randomness Control Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}] | ["Column Selection Checker", "Exception Handling Checker", "InPlace Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"] | 7 | B |
6,927 | categorical_features=['season','month','year','workingday','holiday','weather','hour']
numerical_features=['humidity','windspeed','temp','atemp']
drop_features=['casual','registered','datetime','date','count']
for var in categorical_features:
data[var]=data[var].astype('category') | No | 5 | 16 | Data_Transform | data_type_conversions | 1,318,352 | 1 | A | 0 | 1 | 1 | 0 | 0 | 5 | 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 |
6,928 | train=data[pd.notnull(data['count'])].sort_values(by=['datetime'])
test=data[~pd.notnull(data['count'])].sort_values(by='datetime')
datetimecol=test['datetime']
y_train=train['count']
y_train_registered=train['registered']
y_train_casual=train['casual']
train=train.drop(drop_features,axis=1)
test=test.drop(drop_featur... | No | 5 | 21 | Data_Transform | prepare_x_and_y | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 8 | 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"] | 7 | B |
6,929 | from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.model_selection import GridSearchCV
from sklearn import metrics
import warnings
pd.options.mode.chained_assignment = None
warnings.filterwarnings("ignore", category=DeprecationWarning)
lr=LinearRegression()
y_train_log=np.log1p(y_train)
lr.fi... | Yes | 2 | 22 | Environment | import_modules | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 11 | 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, 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"}] | ["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"] | 7 | B |
6,930 | df_submission | No | 5 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 1 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,931 | df_submission.to_csv('submission.csv', index=False) | No | 5 | 25 | Data_Export | save_to_csv | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,932 | from sklearn.ensemble import RandomForestRegressor
rf=RandomForestRegressor(n_estimators=100)
y_train_log=np.log1p(y_train)
rf.fit(train,y_train_log)
pred=rf.predict(train)
print("RMSLE Value For Random Forest: ", rmsle(y_train_log,pred,True)) | Yes | 3 | 7 | Model_Train | train_model | 1,318,352 | 2 | B | 2 | 0 | 0 | 0 | 10 | 6 | ok | 10 | 8 | [{"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, No random seed setting detected=low, Randomness Control Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}] | ["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"] | 7 | B |
6,933 | # def score(params):<br># print("Training with params : ")<br># print(params)<br># num_round = int(params[\'n_estimators\'])<br># model = xgb.train(params, xtrain, num_round, feval=rmspe_xg)<br># predictions = model.predict(xtest)<br># score = rmspe(y=y_test, yhat=predictions)<br># br = \'-\... | No | 5 | 53 | Other | something_strange | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,935 | # def score(params):<br># print("Training with params : ")<br># print(params)<br># num_round = 25 # int(params[\'n_estimators\'])<br># # del params[\'n_estimators\']<br># dtrain = xgb.DMatrix(X_train, label=y_train)<br># dvalid = xgb.DMatrix(X_test, label=y_test)<br># model = xgb.train(para... | No | 5 | 53 | Other | something_strange | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,936 | # This Python 3 environment comes with many helpful analytics libraries installed<br># It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python<br># For example, here\'s several helpful packages to load in <br><br>import numpy as np # linear algebra<br>import pandas as pd # data processi... | No | 4 | 88 | Debug | list_files | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,937 | baseline_tree_score = 0.23092278864723115
baseline_neuralnetwork_score = 0.5480561937041435 | No | 5 | 77 | Other | define_variables | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,938 | train = pd.read_csv('../input/kaggletutorial/covertype_train.csv')
test = pd.read_csv('../input/kaggletutorial/covertype_test.csv') | No | 5 | 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 |
6,939 | train_index = train.shape[0] | No | 5 | 77 | Other | define_variables | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,940 | lgbm_param = {<br> \'boosting_type\': \'gbdt\',<br> \'objective\': \'binary\',<br> \'metric\': \'binary_logloss\',<br> "learning_rate": 0.06,<br> "num_leaves": 16,<br> "max_depth": 6,<br> "colsample_bytree": 0.7,<br> "subsample": 0.8,<br> "reg_alpha": 0.1,<br> "reg_lambda": 0.1,<br> "n... | No | 5 | 59 | Model_Train | init_hyperparams | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,941 | def keras_model(input_dims):
model = Sequential()
model.add(Dense(input_dims, input_dim=input_dims))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Dropout(0.3))
model.add(Dense(input_dims//2))
model.add(BatchNormalization())
model.add(Activation('relu'... | Yes | 4 | 4 | Model_Train | choose_model_class | null | 1 | A | 0 | 2 | 0 | 0 | 0 | 22 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,942 | from sklearn.ensemble import GradientBoostingRegressor
gbr=GradientBoostingRegressor(n_estimators=4000,alpha=0.01)
y_train_log=np.log1p(y_train)
gbr.fit(train,y_train_log)
pred=gbr.predict(train)
print("RMSLE Value For Gradient Boost: ", rmsle(y_train_log,pred,True)) | Yes | 3 | 7 | Model_Train | train_model | 1,318,352 | 2 | B | 2 | 0 | 0 | 0 | 10 | 6 | ok | 9 | 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, 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"}] | ["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"] | 7 | B |
6,943 | lgbm_param = {<br> \'boosting_type\': \'gbdt\',<br> \'objective\': \'binary\',<br> \'metric\': \'binary_logloss\',<br> "learning_rate": 0.03,<br> "num_leaves": 24,<br> "max_depth": 6,<br> "colsample_bytree": 0.65,<br> "subsample": 0.7,<br> "reg_alpha": 0.1,<br> "reg_lambda": 0.2,<br> "... | No | 5 | 59 | Model_Train | init_hyperparams | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,944 | pred_test=gbr.predict(test)
fig,(ax1,ax2)=plt.subplots(ncols=2)
sn.distplot(y_train,ax=ax1,bins=50)
sn.distplot(np.exp(pred_test),ax=ax2,bins=50) | Yes | 3 | 48 | Model_Evaluation | predict_on_test | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti... | A | no applicable ML-specific findings | [] | ["Exception Handling Checker", "Unit Testing Checker"] | 7 | A |
6,945 | submission=pd.DataFrame({
'datetime':datetimecol,
'count':[max(0,x) for x in np.exp(pred_test)]
})
submission.to_csv('bike_predictions_gbm.csv',index=False) | Yes | 4 | 25 | Data_Export | save_to_csv | 1,318,352 | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 7 | A |
6,946 | import os
print((os.listdir('../input/'))) | No | 5 | 88 | Debug | list_files | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,947 | import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score | No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 0 | A |
6,948 | df_train = pd.read_csv('../input/web-club-recruitment-2018/train.csv')
df_test = pd.read_csv('../input/web-club-recruitment-2018/test.csv')
feature_cols=['X1','X2','X3','X5','X6','X7','X8','X9','X10','X12','X13','X14','X15','X16','X17','X18','X19','X20','X21','X22','X23'] | No | 5 | 45 | Data_Extraction | load_from_csv | 1,474,203 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 3 | 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."] | 3 | A |
6,949 | dtrain = lgbm.Dataset(train_df, label=y_value)
clf = lgbm.train(lgbm_param, train_set=dtrain, num_boost_round=5000)
predict = clf.predict(test_df) | Yes | 3 | 7 | Model_Train | train_model | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 5 | 5 | [{"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, 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"}] | ["Exception Handling Checker", "Unit Testing Checker"] | 9 | B |
6,950 | submission = pd.read_csv('../input/kaggletutorial/sample_submission.csv')
submission['Cover_Type'] = predict
submission.to_csv('lgbm_last.csv', index=False) | No | 3 | 25 | Data_Export | save_to_csv | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | 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"] | 9 | A |
6,951 | def keras_model(input_dims):
model = Sequential()
model.add(Dense(input_dims, input_dim=input_dims))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Dropout(0.3))
model.add(Dense(input_dims))
model.add(BatchNormalization())
model.add(Activation('relu'))
... | No | 5 | 84 | Other | not_enough_vertices | 1,463,038 | 1 | A | 0 | 1 | 0 | 0 | 0 | 23 | ok | 1 | 1 | [{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: keras_model. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 10"}] | A | no applicable ML-specific findings | [] | ["Missing function docstring"] | 9 | A |
6,952 | y_value = train_df['Cover_Type']
del train_df['Cover_Type'], train_df['ID']
del test_df['Cover_Type'], test_df['ID']
model = keras_model(train_df.shape[1])
callbacks = [
EarlyStopping(
patience=10,
verbose=10)
] | No | 4 | 4 | Model_Train | choose_model_class | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 9 | 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"] | 9 | A |
6,953 | """ CV .<br>NFOLD = 5<br>folds = StratifiedKFold(n_splits= NFOLD, shuffle=True, random_state=2018)<br><br>total_score = 0<br>best_epoch = 0<br>for n_fold, (train_idx, valid_idx) in enumerate(folds.split(train_df, y_value)):<br> train_x, train_y = train_df.iloc[train_idx], y_value.iloc[train_idx]<br> valid_x, va... | Yes | 3 | 7 | Model_Train | train_model | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 0 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,954 | history = model.fit(train_df.values, y_value.values, nb_epoch=30, batch_size = 64, verbose=1)
predict = model.predict(test_df.values) | Yes | 3 | 7 | Model_Train | train_model | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 7 | 6 | [{"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, 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"}] | ["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"] | 9 | B |
6,955 | submission_nn = pd.read_csv('../input/kaggletutorial/sample_submission.csv')
submission_nn['Cover_Type'] = predict
submission_nn.to_csv('nn_last.csv', index=False) | No | 4 | 25 | Data_Export | save_to_csv | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | 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"] | 9 | A |
6,956 | source = submission.copy()
source = source.merge(submission_nn,on='ID')
source | No | 5 | 32 | Data_Transform | merge | 1,463,038 | 1 | A | 0 | 0 | 0 | 1 | 0 | 3 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
6,957 | lgbm_param1 = {<br> \'boosting_type\': \'dart\',<br> \'objective\': \'binary\',<br> \'metric\': \'binary_logloss\',<br> "learning_rate": 0.03,<br> "num_leaves": 31,<br> "max_depth": 7,<br> "colsample_bytree": 0.8,<br> "subsample": 0.8,<br> "reg_alpha": 0.1,<br> "reg_lambda": 0.1,<br> "... | No | 5 | 59 | Model_Train | init_hyperparams | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,958 | et_model = SklearnWrapper(clf = ExtraTreesClassifier, params=et_parmas)
rf_model = SklearnWrapper(clf = RandomForestClassifier, params=rf_params) | No | 5 | 4 | Model_Train | choose_model_class | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
6,959 | x_train = pd.DataFrame(x_train_second_layer)
x_test = pd.DataFrame(x_test_second_layer) | No | 5 | 12 | Data_Transform | create_dataframe | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
6,960 | submission_stacking = pd.read_csv('../input/kaggletutorial/sample_submission.csv')
submission_stacking['Cover_Type'] = predict_stacking
submission_stacking.to_csv('submission_stacking.csv', index=False) | No | 4 | 25 | Data_Export | save_to_csv | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | 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"] | 9 | A |
6,961 | submission_et = pd.read_csv('../input/kaggletutorial/sample_submission.csv')
submission_et['Cover_Type'] = et_test
submission_et.to_csv('submission_et.csv', index=False) | No | 4 | 25 | Data_Export | save_to_csv | 1,463,038 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | 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"] | 9 | A |
6,962 | import cv2 # working with, mainly resizing, images<br>import numpy as np # dealing with arrays<br>import os # dealing with directories<br>from random import shuffle # mixing up or currently ordered data that might lead our network astray in training.<br>from tqdm import tqdm ... | Yes | 4 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,963 | train_X = df_train[feature_cols]
train_y = df_train.loc[:, 'Y']
df_test = df_test[feature_cols] | No | 5 | 21 | Data_Transform | prepare_x_and_y | 1,474,203 | 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"] | 3 | A |
6,964 | rf = RandomForestClassifier(n_estimators=200,max_features='auto',max_depth=23) | No | 5 | 4 | Model_Train | choose_model_class | 1,474,203 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Randomness Control Checker", "fix": "Set random_state in estimators for reproducibility.", "benefits": "Ensures reproducible results and consistent model behaviour.", "location": "Line 4"}, {"detector": "framework_specific", "framework": "ScikitLe... | B | Randomness Control Checker=low | [{"type": "Randomness Control Checker", "severity": "low"}] | ["Verbose Mode Checker"] | 3 | B |
6,965 | train_data = create_train_data()
# If you have already created the dataset:
#train_data = np.load('train_data.npy') | No | 5 | 53 | Other | something_strange | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,966 | rf.fit(train_X, train_y) | 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,967 | import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
convnet = input_data(shape=[None, IMG_SIZE, IMG_SIZE, 1], name='input')
convnet = conv_2d(convnet, 32, 5, activation='relu')
convnet ... | Yes | 4 | 4 | Model_Train | choose_model_class | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 14 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
6,968 |
pred = rf.predict_proba(df_test) | No | 5 | 48 | Model_Evaluation | predict_on_test | 1,474,203 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 3 | 3 | [{"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": ""}, {"detector": "framework_specific", "framework":... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker"] | 3 | A |
6,969 | if os.path.exists('{}.meta'.format(MODEL_NAME)):
model.load(MODEL_NAME)
print('model loaded!') | No | 5 | 30 | Model_Train | load_pretrained | null | 1 | A | 0 | 1 | 1 | 0 | 0 | 3 | 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.