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,503
# drop address columns train = train.drop(['Address', 'AddressNumberAndStreet','WnvPresent', 'NumMosquitos'], axis = 1) test = test.drop(['Id', 'Address', 'AddressNumberAndStreet'], axis = 1)
No
5
10
Data_Transform
drop_column
716,075
1
A
0
0
0
0
0
2
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,504
test["created"] = pd.to_datetime(test["created"])<br>test[\'day_of_week\'] = test[\'created\'].dt.weekday
Yes
3
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,505
train['created_day'] = train['created'].dt.day
No
5
8
Data_Transform
feature_engineering
685,472
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,506
test['created_day'] = test['created'].dt.day
No
5
8
Data_Transform
feature_engineering
685,472
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,507
### Iterest per Day of Week<br>fig = plt.figure(figsize=(12,6))<br>sns.countplot(x="created_day", hue="interest_level", hue_order=[\'low\', \'medium\', \'high\'], data=train);<br>plt.xlabel(\'created_day\');<br>plt.ylabel(\'Number of occurrences\');
No
5
75
Visualization
time_series
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,508
# Merge with weather data train = train.merge(weather, on='Date') test = test.merge(weather, on='Date') train = train.drop(['Date'], axis = 1) test = test.drop(['Date'], axis = 1)
Yes
3
32
Data_Transform
merge
716,075
1
A
0
0
0
0
0
4
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": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
3
B
6,509
# Convert categorical data to numbers lbl = preprocessing.LabelEncoder() lbl.fit(list(train['Species'].values) + list(test['Species'].values)) train['Species'] = lbl.transform(train['Species'].values) test['Species'] = lbl.transform(test['Species'].values)
No
5
20
Data_Transform
categorify
716,075
1
A
0
0
0
0
0
4
ok
11
9
[{"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": "Pipeline Che...
D
Cross Validation Checker=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["Column Selection Checker", "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"]
3
D
6,510
train["num_features"] = train["features"].apply(len) test["num_features"] = test["features"].apply(len)
No
5
8
Data_Transform
feature_engineering
685,472
1
A
0
0
0
0
0
2
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,511
llimit = np.percentile(train.latitude.values, 1) ulimit = np.percentile(train.latitude.values, 99) train['latitude'].ix[train['latitude']<llimit] = llimit train['latitude'].ix[train['latitude']>ulimit] = ulimit plt.figure(figsize=(8,6)) sns.distplot(train.latitude.values, bins=50, kde=False) plt.xlabel('latitude', fon...
Yes
3
33
Visualization
distribution
685,472
1
A
0
0
0
0
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,512
llimit = np.percentile(train.longitude.values, 1) ulimit = np.percentile(train.longitude.values, 99) train['longitude'].ix[train['longitude']<llimit] = llimit train['longitude'].ix[train['longitude']>ulimit] = ulimit plt.figure(figsize=(8,6)) sns.distplot(train.longitude.values, bins=50, kde=False) plt.xlabel('longitu...
Yes
3
33
Visualization
distribution
685,472
1
A
0
0
0
0
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,513
lbl.fit(list(train['Street'].values) + list(test['Street'].values)) train['Street'] = lbl.transform(train['Street'].values) test['Street'] = lbl.transform(test['Street'].values)
No
5
20
Data_Transform
categorify
716,075
1
A
0
0
0
0
0
3
ok
10
8
[{"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...
D
Cross Validation Checker=low, Data Leakage Checker=high, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "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"]
3
D
6,514
train['price']
No
5
41
Debug
show_table
685,472
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,515
lbl.fit(list(train['Trap'].values) + list(test['Trap'].values)) train['Trap'] = lbl.transform(train['Trap'].values) test['Trap'] = lbl.transform(test['Trap'].values)
No
5
20
Data_Transform
categorify
716,075
1
A
0
0
0
0
0
3
ok
10
8
[{"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...
D
Cross Validation Checker=low, Data Leakage Checker=high, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "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"]
3
D
6,516
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'price\', shade=True)<br>facet.add_legend()<br>plt.show()
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,517
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'price\', shade=True)<br>facet.set(xlim=(0,100000))<br>facet.add_legend()<br>plt.show()
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,518
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'price\', shade=True)<br>facet.set(xlim=(100000,200000))<br>facet.add_legend()<br>plt.show()
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,519
# drop columns with -1s train = train.ix[:,(train != -1).any(axis=0)] test = test.ix[:,(test != -1).any(axis=0)]
No
4
10
Data_Transform
drop_column
716,075
1
A
0
0
0
0
0
2
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,520
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'price\', shade=True)<br>facet.set(xlim=(0,10000))<br>facet.add_legend()<br>plt.show()
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,521
# Random Forest Classifier clf = ensemble.RandomForestClassifier(n_jobs=1, n_estimators=1000, min_samples_split= 2) clf.fit(train, labels)
No
5
7
Model_Train
train_model
716,075
1
A
0
0
0
0
0
2
ok
6
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, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
3
B
6,522
features_drop = ['building_id', 'created', 'description', 'display_address', 'features', 'manager_id', 'photos', 'street_address', 'month_created', 'date_created'] train1 = train.drop(features_drop, axis=1)
No
5
10
Data_Transform
drop_column
685,472
1
A
0
0
0
0
0
2
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,523
features_drop = ['building_id', 'created', 'description', 'display_address', 'features', 'manager_id', 'photos', 'street_address'] test1 = test.drop(features_drop, axis=1)
No
5
10
Data_Transform
drop_column
685,472
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,524
X = train[['bathrooms','bedrooms','latitude','longitude','price','day_of_week','created_day','num_features']] y = train1['interest_level']
No
5
21
Data_Transform
prepare_x_and_y
685,472
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,525
from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import log_loss X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.33)
Yes
4
22
Environment
import_modules
685,472
1
A
1
0
0
0
5
4
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"}]
[]
3
B
6,526
X = test[['bathrooms','bedrooms','latitude','longitude','price','day_of_week','created_day','num_features']] y = clf.predict_proba(X)
Yes
3
21
Data_Transform
prepare_x_and_y
685,472
1
A
0
0
0
0
0
2
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,527
t = 732 m=8 n=8
No
5
77
Other
define_variables
736,747
1
A
0
0
0
0
0
3
ok
3
1
[{"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 732", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}, {"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 8", "fix": "Not specified", "benefits": "Not specified", "locatio...
A
no applicable ML-specific findings
[]
["Magic number"]
3
A
6,528
df = pd.read_csv('../input/data.txt',skiprows=2,sep=' ',names=list(map(str,(list(range(n))))))
No
5
45
Data_Extraction
load_from_csv
736,747
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/data.txt. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
3
A
6,529
sub = pd.DataFrame() sub["listing_id"] = test["listing_id"] for label in ["high", "medium", "low"]: sub[label] = y[:, labels2idx[label]] sub.to_csv("submission_rf.csv", index=False)
Yes
3
45
Data_Extraction
load_from_csv
685,472
1
A
0
1
1
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,530
from sklearn.feature_extraction.text import TfidfVectorizer from nltk.corpus import stopwords from nltk import word_tokenize import pandas as pd import numpy as np import re from sklearn.model_selection import train_test_split from collections import defaultdict from sklearn.linear_model import LogisticRegression from ...
No
5
22
Environment
import_modules
807,552
1
A
0
0
0
0
0
12
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"]
7
A
6,531
with open('../input/train.json') as f: raw_train = json.load(f) with open('../input/test.json') as f: raw_test = json.load(f)
No
5
44
Data_Extraction
load_from_disk
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,532
softmax = LogisticRegression(**m_params)
No
5
4
Model_Train
choose_model_class
807,552
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Scaler Missing Checker", "fix": "Apply scaling before scaling-sensitive operations.", "benefits": "Improves model performance and accuracy.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Thresh...
C
Scaler Missing Checker=medium
[{"type": "Scaler Missing Checker", "severity": "medium"}]
["Dependent Threshold Checker"]
7
C
6,533
test_x = [j for i in sorted(val.keys()) for j in val[i]] true = [i for i in sorted(val.keys()) for j in val[i]]
No
5
53
Other
something_strange
807,552
2
B
1
0
0
0
5
2
ok
2
2
[{"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
[]
["Column Selection Checker", "Dependent Threshold Checker"]
7
B
6,534
pred = softmax.predict(tfidf.transform(test_x))
No
5
48
Model_Evaluation
predict_on_test
807,552
1
A
0
0
0
0
0
1
ok
6
5
[{"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":...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["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"]
7
B
6,535
accuracy_score(true, pred)
No
5
49
Model_Evaluation
compute_test_metric
807,552
1
A
0
0
0
0
0
1
ok
2
2
[{"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", "Unit Testing Checker"]
7
A
6,536
lab = LabelEncoder() c_true = lab.fit_transform(true) c_pred = lab.transform(pred) print(classification_report(c_true, c_pred, target_names=lab.classes_, digits=5))
No
4
20
Data_Transform
categorify
807,552
1
A
0
0
0
0
0
4
ok
10
9
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Pipeline Checker", "fix": "Use Pipelines for all scikit-learn estimators.", "benefits": "Prevents data leakage and ensures correct model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross V...
D
Cross Validation Checker=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["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", "Verbose Mode Checker"]
7
D
6,537
sub_df.to_csv('softmax_reg.csv', index=False)
No
5
25
Data_Export
save_to_csv
807,552
1
A
0
0
0
0
0
1
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"]
7
A
6,538
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import warnings % matplotlib inline from datetime import datetime from scipy import stats pd.options.mode.chained_assignment = None from scipy.stats import norm, skew warnings.filterwarnings("ignore", category=DeprecationWarnin...
No
5
23
Environment
set_options
817,152
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
8
null
6,539
train = pd.read_csv('../input/train.csv') test = pd.read_csv('../input/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,540
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,541
train.describe()
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,542
print('Train Dataset Shape : {0}'.format(train.shape)) print('Test Dataset Shape : {0}'.format(test.shape))
No
5
58
Debug
show_shape
817,152
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
6,543
train.dtypes
No
5
70
Debug
show_data_types
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,544
sns.boxplot(train['count'])
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,545
new_df = pd.DataFrame(new_df)
No
5
12
Data_Transform
create_dataframe
736,747
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,546
train = train[np.abs(train["count"]-train["count"].mean())<=(3*train["count"].std())]
Yes
4
14
Data_Transform
filter
817,152
1
A
0
0
0
0
0
1
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"}]
[]
8
B
6,547
fig,ax = plt.subplots(2,1,figsize = (10,10))<br>sns.distplot(train[\'count\'],ax=ax[0])<br>stats.probplot(train["count"], dist=\'norm\', fit=True, plot=ax[1])<br>print(\'Skewness : {0}\'.format(train[\'count\'].skew()))<br>print(\'Kurt : {0}\'.format(train[\'count\'].kurt()))
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,548
new_df['m'] = new_df['t'].apply(lambda x : int(x)%8)
No
5
8
Data_Transform
feature_engineering
736,747
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"]
3
A
6,549
fig,ax = plt.subplots(2,1,figsize = (10,10))<br>#logcount = np.log1p(train[\'count\']).kurt()<br>#rootcount = np.sqrt(train[\'count\']).kurt()<br>#cubiccount = np.power(train[\'count\'],2).kurt()<br>#minVal = min([logcount, rootcount, cubiccount])<br>#if logcount == minVal:<br>best = \'log\'<br>train[\'count_log\'] = n...
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,550
new_df['t'] = new_df['t'].apply(lambda x:x//8)
No
5
8
Data_Transform
feature_engineering
736,747
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"]
3
A
6,551
new_df['hour'] = new_df['t'].apply(lambda x : x%24 )
No
5
8
Data_Transform
feature_engineering
736,747
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"]
3
A
6,552
train['date'] = train.datetime.apply(lambda x: x.split()[0]) train['hour'] = train.datetime.apply(lambda x: x.split()[1].split(':')[0]) train['weekday'] = train.date.apply(lambda dateString : datetime.strptime(dateString, '%Y-%m-%d').weekday()) train['month'] = train.date.apply(lambda dateString : datetime.strptime(da...
No
4
8
Data_Transform
feature_engineering
817,152
1
A
0
0
0
0
0
5
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"}]
[]
8
B
6,553
new_df['day'] = new_df['t'].apply(lambda x : x//24 )
No
5
8
Data_Transform
feature_engineering
736,747
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"]
3
A
6,554
train.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,555
categorical = [\'date\',\'weekday\',\'month\',\'hour\',\'season\',\'holiday\',\'workingday\',\'weather\']<br>numeric = ["temp","atemp","casual","registered","humidity","windspeed","count","count_log"]
No
5
77
Other
define_variables
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,556
new_df['mm']=new_df['m'] new_df['nn']= new_df['n']
No
5
8
Data_Transform
feature_engineering
736,747
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"]
3
A
6,557
new_df['id'] = new_df['t'].map(str)+':'+new_df['mm'].map(str)+':'+new_df['nn'].map(str)
No
5
8
Data_Transform
feature_engineering
736,747
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"]
3
A
6,558
for idx in categorical: train[idx].astype('category')
Yes
4
16
Data_Transform
data_type_conversions
817,152
1
A
0
1
1
0
0
2
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"}]
[]
8
B
6,559
fig,axes = plt.subplots(ncols=2 ,nrows=2) fig.set_size_inches(15,10) sns.boxplot(data=train,x='season',y='count',ax=axes[0][0]) sns.boxplot(data=train,x='holiday',y='count',ax=axes[0][1]) sns.boxplot(data=train,x='workingday',y='count',ax=axes[1][0]) sns.boxplot(data=train,x='weather',y='count',ax=axes[1][1]) fig1,axe...
No
5
33
Visualization
distribution
817,152
1
A
0
0
0
0
0
9
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
6,560
plt.subplots(figsize=(15,8)) sns.heatmap(train[numeric].corr(),annot=True)
No
5
80
Visualization
heatmap
817,152
1
A
0
0
0
0
0
2
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"}]
[]
8
B
6,561
corr = train[numeric].drop(\'count\', axis=1).corr()<br>corr =corr.drop(\'count_log\', axis=1).corr() # We already examined SalePrice correlations<br>plt.figure(figsize=(12, 10))<br>sns.heatmap(corr[(corr >= 0.5) | (corr <= -0.4)], <br> cmap=\'viridis\', vmax=1.0, vmin=-1.0, linewidths=0.1,<br> an...
No
5
80
Visualization
heatmap
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,562
new_df = df_r.set_index('id').join(new_df.set_index('id'))
No
4
32
Data_Transform
merge
736,747
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,563
### count,month plt.figure(figsize=(15,8)) monthagg = pd.DataFrame(train.groupby('month')['count'].mean()).reset_index() sns.barplot(data=monthagg, x='month',y='count').set(title = 'Month Vs Count')
No
4
33
Visualization
distribution
817,152
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"}]
[]
8
B
6,564
from sklearn.preprocessing import StandardScaler scaler = StandardScaler() scaler.fit(new_df.drop(['val','t','mm','nn'],axis=1))
No
5
18
Data_Transform
normalization
736,747
1
A
0
0
0
0
0
3
ok
6
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Pipeline Checker", "fix": "Use Pipelines for all scikit-learn estimators.", "benefits": "Prevents data leakage and ensures correct model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross V...
D
Cross Validation Checker=low, Data Leakage Checker=high, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "Pipeline Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
3
D
6,565
### count,season,hour plt.figure(figsize=(15,8)) houragg = pd.DataFrame(train.groupby(['hour','season'])['count'].mean()).reset_index() sns.pointplot(data=houragg,x=houragg['hour'],y=houragg['count'],hue=houragg['season']).set(title='Hour,Season Vs Count')
Yes
4
33
Visualization
distribution
817,152
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"}]
[]
8
B
6,566
scaler.transform(new_df.drop(['val','t','mm','nn'],axis=1))
No
5
18
Data_Transform
normalization
736,747
1
A
0
0
0
0
0
1
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"]
3
A
6,567
### count,hour,weekday plt.figure(figsize=(15,8)) hourweekagg = pd.DataFrame(train.groupby(['hour','weekday'])['count'].mean()).reset_index() sns.pointplot(data=hourweekagg,x=hourweekagg['hour'],y=hourweekagg['count'],hue=hourweekagg['weekday']).set(title='Hour,Week Vs Count')
Yes
4
33
Visualization
distribution
817,152
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"}]
[]
8
B
6,568
from sklearn.linear_model import ElasticNet, Lasso, BayesianRidge, LassoLarsIC from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor from sklearn.kernel_ridge import KernelRidge from sklearn.pipeline import make_pipeline from sklearn.preprocessing import RobustScaler from sklearn.base import B...
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
10
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
6,569
new_df[['m1','m2','m3','m4','n','m','hour','day']]=scaler.transform(new_df.drop(['val','t','mm','nn'],axis=1))
No
5
18
Data_Transform
normalization
736,747
1
A
0
0
0
0
0
1
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"]
3
A
6,570
target = train['count'] target_log=train['count_log'] train = train.drop('count_log',axis=1) train = train.drop('count',axis=1) train = train.drop('atemp',axis=1) train = train.drop('date',axis=1) train = train.drop('casual',axis=1) train = train.drop('registered',axis=1) m_dum = pd.get_dummies(train['month'],prefix='m...
Yes
3
10
Data_Transform
drop_column
817,152
1
A
0
0
0
0
0
26
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"}]
[]
8
B
6,571
train = new_df[new_df['val'] !=-1]
No
5
14
Data_Transform
filter
736,747
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"]
3
A
6,572
X_train = train.drop(['val','t','mm','nn'], axis=1) y_train = train['val'].values
No
5
21
Data_Transform
prepare_x_and_y
736,747
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": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
3
B
6,573
test = new_df[new_df['val'] == -1]
No
5
14
Data_Transform
filter
736,747
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"]
3
A
6,574
X_test = test.drop(['val','t','mm','nn'], axis=1)
No
5
10
Data_Transform
drop_column
736,747
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,575
gbr = GradientBoostingRegressor(n_estimators=2000, learning_rate=0.01, max_depth=4).fit(train.values, target_log)
No
5
7
Model_Train
train_model
817,152
1
A
0
0
0
0
0
1
ok
5
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"]
8
B
6,576
import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense from keras.optimizers import adam
No
5
22
Environment
import_modules
736,747
1
A
0
0
0
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,577
model = Sequential() model.add(Dense(128, activation='relu', input_shape=(8,))) model.add(Dense(256, activation='relu')) model.add(Dense(256, activation='relu')) model.add(Dense(1)) model.summary()
No
5
84
Other
not_enough_vertices
736,747
1
A
0
0
0
0
0
6
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,578
model_gbr = GradientBoostingRegressor(n_estimators=1500,max_depth=5,learning_rate=0.01).fit(train.values,target_log)
No
5
7
Model_Train
train_model
817,152
1
A
0
0
0
0
0
1
ok
5
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"]
8
B
6,579
prediction = model_gbr.predict(test.values) prediction = np.expm1(prediction)
Yes
4
48
Model_Evaluation
predict_on_test
817,152
1
A
0
0
0
0
0
2
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"]
8
A
6,580
output = pd.DataFrame() output['datetime'] = testid output['count'] = prediction output.to_csv('output.csv',index=False)
Yes
3
25
Data_Export
save_to_csv
817,152
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
6,581
import glob import os, sys import random from tqdm import tqdm import numpy as np from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array from keras.models import Sequential from keras.layers import Dropout, Flatten, Dense from keras import applications import seaborn as sns import pandas as ...
No
5
23
Environment
set_options
null
1
A
0
0
0
0
0
14
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
6,582
train_data_dir = '../input/dogs-vs-cats-redux-kernels-edition/train' test_data_dir = '../input/dogs-vs-cats-redux-kernels-edition/test' # Make sure you include https://www.kaggle.com/keras/vgg16/data as your data source vgg_model_path = '../input/vgg16/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5' epochs = 20 ba...
No
5
77
Other
define_variables
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,583
# Wrap training data into pandas' DataFrame. lst = list(gen_image_label(train_data_dir)) random.shuffle(lst) if training_n_bound is not None: lst = lst[:training_n_bound] train_df = pd.DataFrame(lst, columns=['label', 'id', 'filename']) train_df = train_df.sort_values(by=['label', 'id']) train_df.head(3)
Yes
3
12
Data_Transform
create_dataframe
null
1
A
0
1
1
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,584
train_df['label_code'] = train_df.label.map({'cat':0, 'dog':1}) train_df.head(3)
Yes
3
41
Debug
show_table
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,585
# Wrap testing data into pandas' DataFrame. lst = list(gen_image_label(test_data_dir)) test_df = pd.DataFrame(lst, columns=['label', 'id', 'filename']) test_df = test_df.sort_values(by=['label', 'id']) test_df['label_code'] = test_df.label.map({'cat':0, 'dog':1}) test_df.head(3)
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,586
sns.countplot(train_df.label) plt.title('Number of training images per category')
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,587
model.fit(train_embeddings[train_indices,:], train_labels, epochs=epochs, batch_size=batch_size, validation_data=(train_embeddings[validate_indices,:], validation_labels)) model.save_weights(embedding_fc_model)
Yes
3
7
Model_Train
train_model
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,588
from sklearn.metrics import f1_score, accuracy_score pred_validation = model.predict(train_embeddings[validate_indices,:]) f1 = f1_score(validation_labels, pred_validation > 0.5) acc = accuracy_score(validation_labels, pred_validation > 0.5) (f1, acc)
Yes
4
49
Model_Evaluation
compute_test_metric
null
1
A
0
0
0
0
0
5
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"]
0
A
6,589
pred_test = model.predict(test_embeddings) pred_test.shape
Yes
3
48
Model_Evaluation
predict_on_test
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,590
results = pd.DataFrame({'id': pd.Series(test_df.id.values[:pred_test.shape[0]]), 'label': pd.Series(pred_test.T[0])}) results.to_csv('submission.csv', index=False) results.head(10)
Yes
4
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,591
df = pd.DataFrame(np.concatenate((X, train_labels[:train_embeddings[train_indices,:].shape[0]].reshape(train_embeddings[train_indices,:].shape[0],1)), axis=1), columns=['X', 'Y', 'Z', 'label'])
No
5
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,592
g = sns.FacetGrid(df, hue="label", size=7) g.map(plt.scatter, "X", "Y", alpha=.5) g.add_legend(); g = sns.FacetGrid(df, hue="label", size=7) g.map(plt.scatter, "Y", "Z", alpha=.5) g.add_legend(); g = sns.FacetGrid(df, hue="label", size=7) g.map(plt.scatter, "X", "Z", alpha=.5) g.add_legend();
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
9
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,593
from nltk import word_tokenize from nltk.corpus import stopwords import pandas as pd import numpy as np import re from sklearn.metrics import accuracy_score, classification_report from sklearn.preprocessing import LabelEncoder from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.base import BaseEsti...
No
5
22
Environment
import_modules
951,820
1
A
0
0
0
0
0
15
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"]
9
A
6,594
train, val = train_test_split(raw_train, test_size=0.2, random_state=2018)
No
5
13
Data_Transform
split
951,820
1
A
0
0
0
0
0
1
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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker"]
9
B
6,595
pred = [] test_pred = [] for i in range(3): p.get_params()['lr'].class_weight = {0: 1, 1:w[i] } p.fit(train_x, train_y[i]) pred.append(p.decision_function(val_x)) test_pred.append(p.decision_function(test_x))
Yes
3
7
Model_Train
train_model
951,820
1
A
0
1
1
0
0
7
ok
6
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": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
9
B
6,596
accuracy_score(val_y, np.argmax(np.array(pred), axis=0))
No
5
49
Model_Evaluation
compute_test_metric
951,820
1
A
0
0
0
0
0
1
ok
3
3
[{"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 10"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Depen...
A
no applicable ML-specific findings
[]
["Array Creation Efficiency", "Dependent Threshold Checker", "Unit Testing Checker"]
9
A
6,597
sub_df = pd.DataFrame() sub_df['id'] = [i['id'] for i in raw_test] sub_df['sentiment'] = np.argmax(np.array(test_pred), axis=0) sub_df['sentiment']= sub_df['sentiment'].apply(lambda x: lab.classes_[x])
Yes
4
8
Data_Transform
feature_engineering
951,820
1
A
0
0
0
0
0
4
ok
3
3
[{"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": "NumPy", "name": "Array Creation Eff...
A
no applicable ML-specific findings
[]
["Array Creation Efficiency", "Column Selection Checker", "Dependent Threshold Checker"]
9
A
6,598
sub_df.to_csv('nb.csv', index=False)
No
5
25
Data_Export
save_to_csv
951,820
1
A
0
0
0
0
0
1
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"]
9
A
6,599
# 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...
Yes
4
22
Environment
import_modules
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,600
# initializations related to threading stuff batch_size = 500 num_train_images = 25000 num_test_images = 12500 num_train_threads = int(num_train_images/batch_size) # 50 num_test_threads = int(num_test_images/batch_size) # 25 lock = Lock()
No
4
77
Other
define_variables
1,002,729
1
A
0
0
0
0
0
6
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,601
print(train_x.shape) print(len(train_y))
No
5
58
Debug
show_shape
1,002,729
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,602
test_x =get_testing_data() print(test_x.shape)
Yes
4
58
Debug
show_shape
1,002,729
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A