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,103
d = devicelabels.dropna(subset=['trainrow']) Xtr_label = csr_matrix((np.ones(d.shape[0]), (d.trainrow, d.label)), shape=(gatrain.shape[0],nlabels)) d = devicelabels.dropna(subset=['testrow']) Xte_label = csr_matrix((np.ones(d.shape[0]), (d.testrow, d.label)), shape=(gatest....
No
4
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,104
Xtrain = hstack((Xtr_brand, Xtr_model, Xtr_app, Xtr_label), format='csr') Xtest = hstack((Xte_brand, Xte_model, Xte_app, Xte_label), format='csr') print('All features: train shape {}, test shape {}'.format(Xtrain.shape, Xtest.shape))
No
4
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,105
targetencoder = LabelEncoder().fit(gatrain.gender) y = targetencoder.transform(gatrain.gender) nclasses = len(targetencoder.classes_)
No
5
20
Data_Transform
categorify
144,515
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,106
clf = LogisticRegression(C=0.08)#, multi_class='multinomial',solver='lbfgs') clf.fit(Xtrain[70001:], y[70001:]) pred = pd.DataFrame(clf.predict_proba(Xtrain[70001:]), index=gatrain.iloc[70001:].index, columns=targetencoder.classes_) pred.head()
Yes
3
7
Model_Train
train_model
144,515
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,107
pred.to_csv('test_gender.csv',index=True)
No
5
25
Data_Export
save_to_csv
144,515
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,108
import sys import os import math import numpy as np import pandas as pd import seaborn as sns from scipy.stats import norm, gumbel_r from scipy.optimize import linprog import matplotlib import matplotlib.pyplot as plt from sklearn.utils.extmath import cartesian %matplotlib inline
No
5
23
Environment
set_options
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
6,109
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,110
def plot_bag_weight_distributions(bags, size=10000): plot_distributions(bags, create_bag_weight_sampler, size=size, fit=norm) def plot_distributions(bags, sampler_builder, size=10000, fit=None): num_plots = len(bags) num_cols = int(round(math.sqrt(num_plots))) num_rows = (num_plots // num_cols) num...
No
5
33
Visualization
distribution
null
1
A
1
4
2
0
5
32
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,111
example_bags = [ {"horse": 1, "ball": 2}, {"train": 3, "bike": 1}, {"coal": 2, "book": 2}, {"gloves": 12, "book": 12}, ] plot_bag_weight_distributions(example_bags)
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,112
def plot_bag_utility_distributions(bags, size=10000, fit=norm):<br> plot_distributions(bags, create_bag_utility_sampler, size=size, fit=fit)<br><br>def create_bag_utility_sampler(bag):<br> bag_weight_sampler, bag_name = create_bag_weight_sampler(bag)<br> def bag_utility_sampler(size=1):<br> samples = ba...
Yes
4
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,113
def plot_score_distribution(bags, num_tries=60, size=10000, fit=norm, extremal_fit=gumbel_r):<br> scores = np.zeros(size)<br> for i, bag in enumerate(bags):<br> current_bag_sampler, _ = create_bag_utility_sampler(bag)<br> scores += current_bag_sampler(size)<br> score_mean, score_std = np.mean(sco...
Yes
4
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,114
def drop_duplicate(candidate_bags, distributions): df = pd.DataFrame(data=np.hstack((candidate_bags, distributions)), columns=gifts + ["mean", "var"]) df.drop_duplicates(subset=gifts, inplace=True) return df[gifts].values, df[["mean", "var"]].values candidate_bags = np.vstack([mixed_item_candiadte_bags, lo...
Yes
3
11
Data_Transform
concatenate
166,245
1
A
0
1
0
0
0
9
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,115
pd.read_csv('submission_20.csv').head()
No
5
41
Debug
show_table
166,245
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,116
import numpy as np import pandas as pd from subprocess import check_output print(check_output(["ls", "../input"]).decode("utf8"))
No
5
88
Debug
list_files
179,492
1
A
0
0
0
0
0
4
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": "general_ml", "framework": "Genera...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Hardcoded file path"]
11
A
6,117
train = pd.read_json("../input/train.json") train.info()
No
5
44
Data_Extraction
load_from_disk
179,492
1
A
0
0
0
0
0
2
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": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Hardcoded file path"]
11
B
6,118
X = train.drop("interest_level", 1) Y = train["interest_level"].astype("category")
No
5
21
Data_Transform
prepare_x_and_y
179,492
1
A
0
0
0
0
0
2
ok
5
5
[{"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", "Dependent Threshold Checker"]
11
B
6,119
X["street_address"] = X["street_address"].astype(\'category\').cat.codes<br>X["created"] = X["created"].astype(\'category\').cat.codes<br>X["building_id"] = X["building_id"].astype(\'category\').cat.codes<br>X["description"] = X["description"].astype(\'category\').cat.codes<br>X["display_address"] = X["display_address"...
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,120
features = ["bathrooms", "bedrooms", "latitude", "longitude", "price", "street_address", "created", "description", "display_address"] X = X[features]
No
4
21
Data_Transform
prepare_x_and_y
179,492
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": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Dependent Threshold Checker"]
11
A
6,121
from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.20, random_state=42)
No
5
13
Data_Transform
split
179,492
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker"]
11
B
6,122
from sklearn.metrics import accuracy_score, log_loss<br>from sklearn.neighbors import KNeighborsClassifier<br>from sklearn.tree import DecisionTreeClassifier<br>from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier<br>from sklearn.naive_bayes import GaussianNB<br>from sklea...
Yes
3
4
Model_Train
choose_model_class
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
6,123
test = pd.read_json("../input/test.json") index = test["listing_id"] test = test[features]
No
5
44
Data_Extraction
load_from_disk
179,492
1
A
0
0
0
0
0
3
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": "ScikitLearn", "name": "Dependent Th...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Dependent Threshold Checker", "Hardcoded file path"]
11
A
6,124
olist = list(test.select_dtypes(['object'])) for col in olist: test[col] = test[col].astype('category').cat.codes
No
5
8
Data_Transform
feature_engineering
179,492
1
A
0
1
1
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": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Dependent Threshold Checker"]
11
A
6,125
favorite_clf = LinearDiscriminantAnalysis() favorite_clf.fit(X_train, y_train) test_predictions = favorite_clf.predict_proba(test)
Yes
3
7
Model_Train
train_model
179,492
1
A
0
0
0
0
0
3
ok
9
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
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "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", "Verbose Mode Checker"]
11
B
6,126
submission = pd.DataFrame({<br> "listing_id": index,<br> "high": test_predictions[:,0],<br> "medium":test_predictions[:,2],<br> "low":test_predictions[:,1]<br> })<br> <br>columnsTitles=["listing_id","high","medium","low"]<br>submission=submission.reindex(columns=columnsTitles)<br>submi...
Yes
4
25
Data_Export
save_to_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,127
from keras.models import Sequential from keras.layers import Dense
No
5
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,128
from keras.utils import np_utils from sklearn.preprocessing import LabelEncoder encoder = LabelEncoder() encoder.fit(Y) encoded_Y = encoder.transform(Y) # convert integers to dummy variables (i.e. one hot encoded) dummy_y = np_utils.to_categorical(encoded_Y)
No
5
20
Data_Transform
categorify
179,492
1
A
0
0
0
0
0
6
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"]
11
D
6,129
# Compile model model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) # Fit the model model.fit(X.values, dummy_y, nb_epoch=10, batch_size=10)
No
4
7
Model_Train
train_model
179,492
1
A
0
0
0
0
0
2
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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
11
B
6,130
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from subprocess import check_output from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier, VotingC...
No
5
88
Debug
list_files
179,634
1
A
0
0
0
0
0
8
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 14"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
6
A
6,131
sub = pd.read_csv('../input/sample_submission.csv') sub.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,132
df = pd.read_json('../input/train.json') df.tail()
Yes
4
44
Data_Extraction
load_from_disk
179,634
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/train.json. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 7"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
6
A
6,133
df['address'] = df['display_address'].astype('category').cat.codes df['street_address'] = df['street_address'].astype('category').cat.codes df['building_id'] = df['building_id'].astype('category').cat.codes df['manager_id'] = df['manager_id'].astype('category').cat.codes df['num_features'] = df['features'].apply(len) d...
No
5
8
Data_Transform
feature_engineering
179,634
1
A
0
0
0
0
0
10
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
6
A
6,134
new_feat = ['price','address','manager_id','building_id', 'num_features','created_year','created_month', 'len_description','latitude','longitude','num_pics'] #new_feat = ['price','latitude','longitude','num_pics', # 'num_features','created_year','created_month','len_description'] X =...
Yes
3
21
Data_Transform
prepare_x_and_y
179,634
1
A
1
0
0
0
5
7
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
6
B
6,135
clf1 = GradientBoostingClassifier(n_estimators=200, max_depth=9) clf2 = AdaBoostClassifier(n_estimators=200) clf3 = RandomForestClassifier(n_estimators=300) estimators = [('gb', clf1), ('ab', clf2), ('rf', clf3)] vclf = VotingClassifier(estimators=estimators, voting='soft', n_jobs= -1) vclf.fit(X_train, y_train) y_va...
Yes
3
4
Model_Train
choose_model_class
179,634
1
A
0
0
0
0
0
8
ok
12
9
[{"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"}]
["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"]
6
B
6,136
X_train = df[new_feat].fillna(0) y_train = df['interest_level'] vclf.fit(X_train, y_train) df2 = pd.read_json('../input/test.json') df2['address'] = df2['display_address'].astype('category').cat.codes df2['street_address'] = df2['street_address'].astype('category').cat.codes df2['building_id'] = df2['building_id'].as...
Yes
3
8
Data_Transform
feature_engineering
179,634
1
A
0
0
0
0
0
16
ok
11
10
[{"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", "Dependent Threshold Checker", "Exception Handling Checker", "Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
6
B
6,137
sub = pd.read_csv('submissionVoting.csv') sub.head()
Yes
4
45
Data_Extraction
load_from_csv
179,634
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
6,138
from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import log_loss
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,139
df = pd.read_json(open("../input/train.json", "r"))
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,140
df.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,141
df["num_photos"] = df["photos"].apply(len) df["num_features"] = df["features"].apply(len) df["num_description_words"] = df["description"].apply(lambda x: len(x.split(" "))) df["created"] = pd.to_datetime(df["created"]) df["created_year"] = df["created"].dt.year df["created_month"] = df["created"].dt.month df["created_d...
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,142
num_feats = ["bathrooms", "bedrooms", "latitude", "longitude", "price", "num_photos", "num_features", "num_description_words", "created_year", "created_month", "created_day"] X = df[num_feats] y = df["interest_level"] X.head()
Yes
4
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,143
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.33)
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,144
clf = RandomForestClassifier(n_estimators=1000) clf.fit(X_train, y_train) y_val_pred = clf.predict_proba(X_val) log_loss(y_val, y_val_pred)
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,145
df = pd.read_json(open("../input/test.json", "r")) df["num_photos"] = df["photos"].apply(len) df["num_features"] = df["features"].apply(len) df["num_description_words"] = df["description"].apply(lambda x: len(x.split(" "))) df["created"] = pd.to_datetime(df["created"]) df["created_year"] = df["created"].dt.year df["cre...
Yes
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
10
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,146
import numpy as np import pandas as pd # Look! No scikit learn!
No
5
22
Environment
import_modules
180,496
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,147
df_train = pd.read_json(open("../input/train.json", "r")) df_train.set_index("listing_id", inplace=True) df_test = pd.read_json(open("../input/test.json", "r")) df_test.set_index("listing_id", inplace=True) # We will work with a concatenation of the two, then split after the scaling. df = pd.concat([df_train, df_test]...
Yes
3
44
Data_Extraction
load_from_disk
180,496
1
A
0
0
0
0
0
5
ok
2
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/train.json. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 3"}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
2
A
6,148
df["num_photos"] = df["photos"].apply(len) df["num_features"] = df["features"].apply(len) df["num_description_words"] = df["description"].apply(lambda x: len(x.split(" "))) df["created"] = pd.to_datetime(df["created"]) #df["created_year"] = df["created"].dt.year df["created_month"] = df["created"].dt.month df["created_...
No
5
8
Data_Transform
feature_engineering
180,496
1
A
1
0
0
0
5
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"]
2
A
6,149
df["logprice"] = np.log(df.price)
No
5
8
Data_Transform
feature_engineering
180,496
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
6,150
df.loc[df.bathrooms == 112, "bathrooms"] = 1
No
5
14
Data_Transform
filter
180,496
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,151
numeric_feat = ["bathrooms", "bedrooms", "latitude", "longitude", "logprice", "num_photos", "num_features", "num_description_words", "created_month", "created_day"] for col in numeric_feat: df[col] -= df[col].min() df[col] /= df[col].max()
No
5
18
Data_Transform
normalization
180,496
1
A
0
1
1
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"]
2
A
6,152
X_train = df.loc[df.interest_level.notnull(), numeric_feat] y_train = pd.get_dummies(df_train[["interest_level"]], prefix="") y_train = y_train[["_high", "_medium", "_low"]] # Set the order according to submission X_test = df.loc[df.interest_level.isnull(), numeric_feat]
Yes
3
14
Data_Transform
filter
180,496
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,153
## A dead simple neural network class in Python+Numpy. Plain SGD, and no regularization. def sigmoid(X): return 1.0 / ( 1.0 + np.exp(-X) ) def softmax(X): _sum = np.exp(X).sum() return np.exp(X) / _sum class neuralnet(object): def __init__(self, num_input, num_hidden, num_output): self._W1 = (...
No
5
4
Model_Train
choose_model_class
null
1
A
1
5
0
0
0
25
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,154
# Some hyper-parameters to tune. num_hidden = 17 # I think I get about 1 epoch/sec with this size on the docker instance n_epochs = 100 eta = 0.01
No
5
59
Model_Train
init_hyperparams
180,496
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 0.01", "fix": "Not specified", "benefits": "Not specified", "location": "Line 6"}]
A
no applicable ML-specific findings
[]
["Magic number"]
2
A
6,155
import os import sys import operator import numpy as np import pandas as pd from scipy import sparse import xgboost as xgb from sklearn import model_selection, preprocessing, ensemble from sklearn.metrics import log_loss from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
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,156
data_path = "../input/" train_file = data_path + "train.json" test_file = data_path + "test.json" train_df = pd.read_json(train_file) test_df = pd.read_json(test_file) print(train_df.shape) print(test_df.shape)
Yes
3
44
Data_Extraction
load_from_disk
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,157
# count of photos # train_df["num_photos"] = train_df["photos"].apply(len) test_df["num_photos"] = test_df["photos"].apply(len) # count of "features" # train_df["num_features"] = train_df["features"].apply(len) test_df["num_features"] = test_df["features"].apply(len) # count of words present in description column # t...
No
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
17
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,158
categorical = ["display_address", "manager_id", "building_id", "street_address"]<br>for f in categorical:<br> if train_df[f].dtype==\'object\':<br> #print(f)<br> lbl = preprocessing.LabelEncoder()<br> lbl.fit(list(train_df[f].values) + list(test_df[f].values))<br> trai...
No
5
20
Data_Transform
categorify
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,159
train_df[\'features\'] = train_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br>test_df[\'features\'] = test_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br>print(train_df["features"].head())<br>tfidf = CountVectorizer(stop_words=\'english\', max_features...
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,160
train_X = sparse.hstack([train_df[features_to_use], tr_sparse]).tocsr() test_X = sparse.hstack([test_df[features_to_use], te_sparse]).tocsr() target_num_map = {'high':0, 'medium':1, 'low':2} train_y = np.array(train_df['interest_level'].apply(lambda x: target_num_map[x])) print(train_X.shape, test_X.shape)
Yes
3
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,161
import os import sys import operator import numpy as np import pandas as pd from scipy import sparse import xgboost as xgb from sklearn import model_selection, preprocessing, ensemble from sklearn.metrics import log_loss from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
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,162
data_path = "../input/" train_file = data_path + "train.json" test_file = data_path + "test.json" train_df = pd.read_json(train_file) test_df = pd.read_json(test_file) print(train_df.shape) print(test_df.shape)
Yes
4
44
Data_Extraction
load_from_disk
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,163
# count of photos # train_df["num_photos"] = train_df["photos"].apply(len) test_df["num_photos"] = test_df["photos"].apply(len) # count of "features" # train_df["num_features"] = train_df["features"].apply(len) test_df["num_features"] = test_df["features"].apply(len) # count of words present in description column # t...
No
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
17
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,164
categorical = ["display_address", "manager_id", "building_id", "street_address"]<br>for f in categorical:<br> if train_df[f].dtype==\'object\':<br> #print(f)<br> lbl = preprocessing.LabelEncoder()<br> lbl.fit(list(train_df[f].values) + list(test_df[f].values))<br> trai...
No
5
20
Data_Transform
categorify
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,165
train_df[\'features\'] = train_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br>test_df[\'features\'] = test_df["features"].apply(lambda x: " ".join(["_".join(i.split(" ")) for i in x]))<br>print(train_df["features"].head())<br>tfidf = CountVectorizer(stop_words=\'english\', max_features...
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,166
train_X = sparse.hstack([train_df[features_to_use], tr_sparse]).tocsr() test_X = sparse.hstack([test_df[features_to_use], te_sparse]).tocsr() target_num_map = {'high':0, 'medium':1, 'low':2} train_y = np.array(train_df['interest_level'].apply(lambda x: target_num_map[x])) print(train_X.shape, test_X.shape)
Yes
3
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,167
out_df.to_csv("xgb_starter2.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,168
df = pd.read_json(open("../input/train.json", \'r\'))<br>df.head()
Yes
4
44
Data_Extraction
load_from_disk
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,169
df['num_photos'] = df['photos'].apply(len) df['num_features'] = df['features'].apply(len) df['num_description_words'] = df['description'].apply(lambda x: len(x.split(' '))) df['created'] = pd.to_datetime(df['created']) df['created_year'] = df['created'].dt.year df['created_month'] = df['created'].dt.month df['created_d...
No
5
8
Data_Transform
feature_engineering
183,411
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"]
5
A
6,170
# price: removing values in 99 percentile df = remove_outlier(df, 'price', [99]) # Latitude & Longitude: # removing outliers: values in the 1/99 percentiles df = remove_outlier(df, 'latitude', [1, 99]) df = remove_outlier(df, 'longitude', [1, 99])
No
4
8
Data_Transform
feature_engineering
183,411
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
6,171
num_feats = ['bathrooms', 'bedrooms', 'latitude', 'longitude', 'price', 'num_photos', 'num_features', 'num_description_words', 'created_year', 'created_month', 'created_day', 'created_hour', 'created_minute'] X = df[num_feats] y = df['interest_level'] X.head()
Yes
4
21
Data_Transform
prepare_x_and_y
183,411
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,172
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=0)
No
5
13
Data_Transform
split
183,411
1
A
0
0
0
0
0
3
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"}]
[]
5
B
6,173
clf = RandomForestClassifier(n_estimators=1000) clf.fit(X_train, y_train) y_val_pred = clf.predict_proba(X_test) log_loss(y_test, y_val_pred)
Yes
3
4
Model_Train
choose_model_class
183,411
1
A
0
0
0
0
0
4
ok
11
9
[{"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"}]
["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"]
5
B
6,174
# fitting the model on the entire data without split clf.fit(X, y)
No
5
7
Model_Train
train_model
183,411
1
A
0
0
0
0
0
1
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
5
B
6,175
df = pd.read_json(open("../input/test.json", \'r\'))<br>df[\'num_photos\'] = df[\'photos\'].apply(len)<br>df[\'num_features\'] = df[\'features\'].apply(len)<br>df[\'num_description_words\'] = df[\'description\'].apply(lambda x: len(x.split(\' \')))<br>df[\'created\'] = pd.to_datetime(df[\'created\'])<br>df[\'created_ye...
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,176
y = clf.predict_proba(X)
No
5
27
Model_Train
predict_on_train
183,411
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"]
5
A
6,177
from sklearn.ensemble import ExtraTreesClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import log_loss
No
5
22
Environment
import_modules
187,669
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
6,178
clf = ExtraTreesClassifier(n_estimators=100) clf.fit(X_train, y_train) y_val_pred = clf.predict_proba(X_val) log_loss(y_val, y_val_pred)
Yes
3
4
Model_Train
choose_model_class
187,669
1
A
0
0
0
0
0
4
ok
9
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
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "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", "Verbose Mode Checker"]
5
B
6,179
import numpy as np # linear algebra<br>import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>from subprocess import check_output<br><br># Load and describe data<br># print(check_output(["ls", "../input"]).decode("utf8"))<br>df = pd.read_jso...
No
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
6,180
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import matplotlib.pyplot as plt #plotting library %matplotlib inline import seaborn as sns #plotting library sns.set(color_codes=True) sns.set_style("white")
No
5
23
Environment
set_options
201,234
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
4
null
6,181
import sklearn.ensemble from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, log_loss
No
5
22
Environment
import_modules
201,234
1
A
0
0
0
0
0
4
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"]
4
A
6,182
# This Python 3 environment comes with many helpful analytics libraries installed<br>train_data = pd.read_json("../input/train.json")<br>test_data = pd.read_json("../input/test.json")<br>display_count = 2<br>target = \'interest_level\'<br>
Yes
4
44
Data_Extraction
load_from_disk
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,183
train_data.iloc[0]
No
5
14
Data_Transform
filter
201,234
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"]
4
A
6,184
train_data['rooms'] = train_data['bedrooms'] + train_data['bathrooms'] train_data['living_rooms'] = train_data['bedrooms'] - train_data['bathrooms'] train_data['even_rooms'] = train_data['rooms'].apply(lambda x : (x%2) == 0)
No
5
8
Data_Transform
feature_engineering
201,234
1
A
0
0
0
0
0
3
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"]
4
B
6,185
def price_per_room(row): rooms = row['rooms'] if rooms == 0: return -1 price_per_room = row['price'] / rooms return price_per_room train_data['price_per_room'] = train_data.apply(lambda row: price_per_room(row), axis=1)
No
5
8
Data_Transform
feature_engineering
201,234
1
A
0
2
1
0
0
7
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": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Missing function docstring"]
4
B
6,186
train_data['created'] = pd.to_datetime(train_data['created']) train_data['year'] = train_data['created'].dt.year train_data['month'] = train_data['created'].dt.month train_data['day'] = train_data['created'].dt.day train_data['hour'] = train_data['created'].dt.hour train_data['month'] = train_data['month'].apply(lambd...
No
5
8
Data_Transform
feature_engineering
201,234
1
A
0
2
2
0
0
7
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, 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"}]
["Dependent Threshold Checker"]
4
B
6,187
train_data['MMDD'] = train_data.apply(lambda x: str(x.month) + str(x.day), axis=1)
No
5
8
Data_Transform
feature_engineering
201,234
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"]
4
B
6,188
month_counts = train_data.groupby(['day', 'hour']).agg({target: 'count'}) month_counts = month_counts.sort_values(target, ascending=False)
Yes
3
60
Data_Transform
groupby
201,234
1
A
0
0
0
0
0
2
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, 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"}]
["Dependent Threshold Checker"]
4
B
6,189
train_data['months_with_less_listings'] = train_data.apply(lambda x: 0 if x['month'] == 31 else 1, axis=1)
No
5
8
Data_Transform
feature_engineering
201,234
1
A
0
1
1
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"]
4
B
6,190
build_group = train_data.groupby([target, 'building_id'])
No
5
60
Data_Transform
groupby
201,234
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"]
4
B
6,191
buildings_with_all_listings = unstacked_df.ix[unstacked_df['frequency'] > 1]
No
5
14
Data_Transform
filter
201,234
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"]
4
A
6,192
print(df.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,193
clf = RandomForestClassifier(n_estimators=1000) clf.fit(X_train, y_train) y_val_pred = clf.predict_proba(X_val) print(y_val_pred.shape) log_loss(y_val, y_val_pred)
Yes
3
4
Model_Train
choose_model_class
201,726
1
A
0
0
0
0
0
5
ok
11
9
[{"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"}]
["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"]
5
B
6,194
df = pd.read_json(open("../input/test.json", "r")) print(df.shape) df["num_photos"] = df["photos"].apply(len) df["num_features"] = df["features"].apply(len) df["num_description_words"] = df["description"].apply(lambda x: len(x.split(" "))) df["created"] = pd.to_datetime(df["created"]) df["created_year"] = df["created"]...
Yes
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,195
sub = pd.DataFrame() sub["listing_id"] = df["listing_id"] for label in ["high", "medium", "low"]: sub[label] = y[:, labels2idx[label]] sub.to_csv("submission_rf.csv", index=False)
No
5
25
Data_Export
save_to_csv
null
1
A
0
1
1
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,196
# 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,197
df = pd.read_json(open("../input/train.json", "r")) df.head(5)
Yes
3
44
Data_Extraction
load_from_disk
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,198
df.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,199
numeric_features = ["bathrooms", "bedrooms", "latitude", "longitude", "price"] X = df[numeric_features] y = df["interest_level"] X.head()
No
3
21
Data_Transform
prepare_x_and_y
202,889
1
A
0
0
0
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,200
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.33) random_forest_classifier = RandomForestClassifier(n_estimators=1500) random_forest_classifier.fit(X_train, y_train) y_val_pred = random_forest_classifier.predict_proba(X_val) log_loss(y_val, y_val_pred)
Yes
3
13
Data_Transform
split
202,889
1
A
0
0
0
0
0
5
ok
12
9
[{"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"}]
["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"]
5
B
6,201
df_test = pd.read_json(open("../input/test.json", "r")) X_test = df_test[numeric_features] y_test = random_forest_classifier.predict_proba(X_test)
Yes
3
44
Data_Extraction
load_from_disk
202,889
1
A
0
0
0
0
0
3
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": "Dependent Th...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
5
A
6,202
plt.figure(figsize=(8, 4))<br>price_group.head(5)["total_price"].plot(kind=\'barh\',color="orange")<br>plt.show()<br>plt.close()<br>
No
4
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null