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,970
result = pd.DataFrame(pred[:,1]) result.index.name = 'id' result.columns = ['predicted_val'] result.to_csv('output.csv', index=True)
Yes
4
25
Data_Export
save_to_csv
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,971
train = train_data[:-500] test = train_data[-500:]
No
4
77
Other
define_variables
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,972
import pandas as pd import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import roc_auc_score from sklearn.ensemble import ExtraTreesClassifier from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split
No
5
22
Environment
import_modules
1,497,226
1
A
0
0
0
0
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
6,973
df_train = pd.read_csv('../input/web-club-recruitment-2018/train.csv') df_test = pd.read_csv('../input/web-club-recruitment-2018/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,974
X = np.array([i[0] for i in train]).reshape(-1,IMG_SIZE,IMG_SIZE,1) Y = [i[1] for i in train] test_x = np.array([i[0] for i in test]).reshape(-1,IMG_SIZE,IMG_SIZE,1) test_y = [i[1] for i in test]
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,975
model.fit({'input': X}, {'targets': Y}, n_epoch=2, validation_set=({'input': test_x}, {'targets': test_y}), snapshot_step=50000, show_metric=True, run_id=MODEL_NAME)
No
5
7
Model_Train
train_model
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,976
X = df_train.loc[:, 'X1':'X23'] y = df_train.loc[:, 'Y']
No
5
14
Data_Transform
filter
1,497,226
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
6,977
import tensorflow as tf tf.reset_default_graph()
No
5
23
Environment
set_options
null
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
6,978
rf.fit(X, y)
No
5
7
Model_Train
train_model
1,497,226
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"]
8
B
6,979
convnet = input_data(shape=[None, IMG_SIZE, IMG_SIZE, 1], name='input') convnet = conv_2d(convnet, 32, 5, activation='relu') convnet = max_pool_2d(convnet, 5) convnet = conv_2d(convnet, 64, 5, activation='relu') convnet = max_pool_2d(convnet, 5) convnet = conv_2d(convnet, 32, 5, activation='relu') convnet = max_pool...
No
2
4
Model_Train
choose_model_class
null
1
A
0
1
1
0
0
29
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,980
model.save(MODEL_NAME)
No
5
50
Model_Train
save_model
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,981
test = df_test.loc[:, 'X1':'X23'] pred = rf.predict_proba(test)
Yes
4
48
Model_Evaluation
predict_on_test
1,497,226
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"]
8
A
6,982
with open('submission_file.csv','w') as f:<br> f.write('id,label\<br>')<br> <br>with open('submission_file.csv','a') as f:<br> for data in tqdm(test_data):<br> img_num = data[1]<br> img_data = data[0]<br> orig = img_data<br> data = img_data.reshape(IMG_SIZE,IMG_SIZE,1)<br> ...
No
5
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,984
import pandas as pd import matplotlib.pyplot as plt import sklearn import os %matplotlib inline print(os.listdir("../input/dataset-adult/"))
No
5
88
Debug
list_files
1,527,751
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
4
null
6,985
#Adult Data adult = pd.read_csv("../input/dataset-adult/train_data.csv",sep=",", na_values="?")
No
5
45
Data_Extraction
load_from_csv
1,527,751
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": "general_ml", "framework": "Genera...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Hardcoded file path"]
4
A
6,986
adult.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,987
import pandas as pd import sklearn
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
6,988
adult.head(3)
No
5
41
Debug
show_table
1,527,751
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,989
import os print(os.listdir('../input'))
No
5
88
Debug
list_files
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,990
adult.info()
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,991
adult = pd.read_csv("../input/dataadult/train_data.csv",<br> sep=r\'\\s*,\\s*\',<br> engine=\'python\',<br> na_values="?")
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,992
adult.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,993
adult.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,994
adult['native.country'].value_counts()
No
5
72
EDA
count_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,995
adult['race'].value_counts().plot(kind="pie")
No
5
33
Visualization
distribution
1,527,751
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,996
#distribuio de idade<br>adult["age"].plot(kind=\'hist\',bins=15);
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,997
#agrupando atributo \'income\' e \'sex\' para cada idade<br>df=adult.groupby(["income","sex"]).mean()<br>df[\'age\'].plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,998
nadult = adult.dropna()
No
5
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,999
#Proporo de sexo por \'income\'<br>df2=adult.groupby(["income","sex"]).size().unstack().plot(kind=\'bar\',stacked=False)
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,000
nadult
No
5
41
Debug
show_table
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,001
#proporo de sexo por ocupao!<br>df2=adult.groupby(["occupation","sex"])[\'race\'].size().unstack().plot(kind=\'barh\',stacked=True)
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,002
#drop colunas empty e index "Id" na_adult=adult.set_index("Id").dropna()
No
5
17
Data_Transform
correct_missing_values
1,527,751
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
7,003
test_adult= pd.read_csv("../input/dataset-adult/test_data.csv",sep=",",na_values="?")
No
5
45
Data_Extraction
load_from_csv
1,527,751
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": "general_ml", "framework": "Genera...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Hardcoded file path"]
4
A
7,004
Yadult = nadult.income
No
4
77
Other
define_variables
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,005
from sklearn.neighbors import KNeighborsClassifier
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
7,006
knn = KNeighborsClassifier(n_neighbors=5)
No
5
4
Model_Train
choose_model_class
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,007
from sklearn.model_selection import cross_val_score
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
7,008
#armazena todos os dados de treino e de teste (numericos e categoricos) X_adult = na_adult.iloc[:,:-1] Y_adult = na_adult.income
No
5
21
Data_Transform
prepare_x_and_y
1,527,751
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker"]
4
A
7,009
X_test = test_adult.iloc[:,:]
No
5
21
Data_Transform
prepare_x_and_y
1,527,751
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
7,010
#treino e teste apenas de dados numericos adult num_cols=["age","education.num","capital.gain","capital.loss","hours.per.week"] X_num=X_adult[num_cols] Y_num=Y_adult X_test= X_test[num_cols]
No
5
21
Data_Transform
prepare_x_and_y
1,527,751
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
7,011
knn.fit(Xadult, Yadult)
No
5
7
Model_Train
train_model
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,012
testadult = pd.read_csv("../input/dataadult/test_data.csv",<br> sep=r\'\\s*,\\s*\',<br> engine=\'python\',<br> na_values="?")
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,013
#importacao de bibliotecas de ML from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import cross_val_score from sklearn.metrics import accuracy_score from sklearn.preprocessing import LabelEncoder
No
5
22
Environment
import_modules
1,527,751
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
7,014
YtestPred = knn.predict(Xtestadult)
No
5
48
Model_Evaluation
predict_on_test
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,015
arr1= testadult.iloc[:,0].values<br>arr1 = arr1.ravel()<br>dataset = pd.DataFrame({\'Id\':arr1[:],\'income\':YtestPred[:]})<br>dataset.to_csv("Adultscompetition.csv", index = False)
Yes
3
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
7,016
import pandas as pd import sklearn
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
7,017
adult = pd.read_csv("../input/adult-db/train_data.csv",header=0, index_col=0, na_values="?")
No
5
45
Data_Extraction
load_from_csv
1,544,504
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/adult-db/train_data.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 8"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
7
A
7,018
print(adult.shape)
No
5
58
Debug
show_shape
1,544,504
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
7,019
#learning e predict knn=KNeighborsClassifier(n_neighbors=9) #instacia model scores = cross_val_score(knn,X_num,Y_num,cv=10) #validacao cruzada knn.fit(X_num,Y_num) Y_testpredict=knn.predict(X_test) scores
Yes
3
4
Model_Train
choose_model_class
1,527,751
1
A
0
0
0
1
0
5
ok
8
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Verbose Mode Checker", "fix": "Enable verbose mode for long training processes.", "benefits": "Provides better insights into model training progress.", "location": "Line 8"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "...
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", "Verbose Mode Checker"]
4
B
7,020
#observando tipo de dados.. test_adult.dtypes
No
5
70
Debug
show_data_types
1,527,751
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
7,021
#Converte 'object columns para 'str', pois object pode conter dados em outro formato: convert_cols=['workclass','education','marital.status','occupation','race','relationship', 'sex','native.country'] test_adult[convert_cols] = test_adult[convert_cols].astype(str)
No
5
16
Data_Transform
data_type_conversions
1,527,751
1
A
0
0
0
0
0
3
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
7,022
#testes.. test_adult.columns
No
5
71
Debug
show_columns
1,527,751
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
7,023
#treino e teste de dados numericos e categoricos: Xencode_adult= na_adult.iloc[:,:-1].apply(LabelEncoder().fit_transform) Xencode_test_adult = test_adult.apply(LabelEncoder().fit_transform) X_adult = Xencode_adult X_test = Xencode_test_adult
No
5
20
Data_Transform
categorify
1,527,751
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
7,024
adult["native.country"].value_counts()
No
5
72
EDA
count_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,025
import matplotlib.pyplot as plt %matplotlib inline
No
5
23
Environment
set_options
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,026
Yfit_adult= LabelEncoder().fit(na_adult["income"]) Y_adult = Yfit_adult.transform(na_adult["income"])
No
5
20
Data_Transform
categorify
1,527,751
1
A
0
0
0
0
0
2
ok
12
10
[{"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, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "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"]
4
D
7,027
adult["age"].value_counts().plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,028
#learning e predict knn =KNeighborsClassifier(n_neighbors=10) scores = cross_val_score(knn,X_adult,Y_adult,cv=10) knn.fit(X_adult,Y_adult) scores
Yes
3
4
Model_Train
choose_model_class
1,527,751
1
A
0
0
0
1
0
4
ok
5
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Verbose Mode Checker", "fix": "Enable verbose mode for long training processes.", "benefits": "Provides better insights into model training progress.", "location": "Line 8"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
A
7,029
adult["sex"].value_counts()
No
5
72
EDA
count_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,030
adult["education.num"].value_counts().plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,031
Ytest_predict= knn.predict(X_test) print(Ytest_predict)
No
5
48
Model_Evaluation
predict_on_test
1,527,751
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"]
4
A
7,032
adult["occupation"].value_counts().plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,033
pd.unique(adult["relationship"])
No
5
57
Debug
show_unique_values
1,544,504
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
7
A
7,034
X_adult.columns
No
5
71
Debug
show_columns
1,527,751
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
7,035
#escolha de atributos para melhor predict atributos=atributos=["age","workclass","education.num","occupation","sex","marital.status","capital.gain","capital.loss"] X_adult = Xencode_adult[atributos] X_test = Xencode_test_adult[atributos]
No
4
21
Data_Transform
prepare_x_and_y
1,527,751
1
A
0
0
0
0
0
3
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
7,036
#Escolhendo k=27 p kNN knn =KNeighborsClassifier(n_neighbors=27) knn.fit(X_adult,Y_adult) scores
Yes
3
4
Model_Train
choose_model_class
1,527,751
1
A
0
0
0
1
0
3
ok
5
5
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
B
7,037
from sklearn.preprocessing import MinMaxScaler minmaxscaler = MinMaxScaler() col_inds = [0,1,4,5,6,7,8,10,11,12] # 0,1 [0,1,3,4,5,6,7,8,9,10,13] 2 [0,1,3,4,5,6,7,8,9,10,11,12,13] 3 [0,1,4,5,6,7,8,10,11,12] Xadult_unscaled = adult_fill.iloc[:,col_inds].apply(LabelEncoder().fit_transform) Xadult = minmaxscaler.fit_transf...
Yes
3
18
Data_Transform
normalization
1,544,504
1
A
0
0
0
0
0
7
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"]
7
D
7,038
Ytest_predict= knn.predict(X_test)
No
5
48
Model_Evaluation
predict_on_test
1,527,751
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"]
4
A
7,039
#dados de submissao label_out = Yfit_adult.inverse_transform(Ytest_predict) df_out = pd.DataFrame({'Id': X_test.index,'income':label_out}) df_out.to_csv('submission_adult.csv',index=False)
No
5
25
Data_Export
save_to_csv
1,527,751
1
A
0
0
0
0
0
3
ok
6
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
D
Cross Validation Checker=low, Data Leakage Checker=high
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
D
7,040
pd.read_csv("submission_adult.csv")
No
5
45
Data_Extraction
load_from_csv
1,527,751
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
7,041
%matplotlib inline import pandas as pd import sklearn import matplotlib.pyplot as plt import numpy as np
No
5
23
Environment
set_options
1,554,855
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
3
null
7,042
testAdult = pd.read_csv("../input/adult-db/test_data.csv",header=0, index_col=0, na_values="?") testAdult.shape
Yes
4
45
Data_Extraction
load_from_csv
1,544,504
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/adult-db/test_data.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 8"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
7
A
7,043
adult = pd.read_csv("../input/mydata/train_data.csv",<br> names=[<br> "Age", "Workclass", "fnlwgt", "Education", "Education-Num", "Martial Status",<br> "Occupation", "Relationship", "Race", "Sex", "Capital Gain", "Capital Loss",<br> "Hours per week", "Country", "Target"],<br> skiprows...
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,044
adult["Country"].value_counts()
No
5
72
EDA
count_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,045
adult["Age"].value_counts().plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,046
adult["Sex"].value_counts().plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,047
adult["Occupation"].value_counts().plot(kind="bar")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,048
XtestAdult_unscaled = testAdult_fill.iloc[:,col_inds].apply(LabelEncoder().fit_transform) XtestAdult = minmaxscaler.transform(XtestAdult_unscaled)
Yes
3
20
Data_Transform
categorify
1,544,504
1
A
0
0
0
0
0
2
ok
3
3
[{"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": "Unit Te...
B
Pipeline Checker=low
[{"type": "Pipeline Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker"]
7
B
7,049
testAdult = pd.read_csv("../input/mydata/test_data.csv",<br> names=[<br> "ID","Age", "Workclass", "fnlwgt", "Education", "Education-Num", "Martial Status",<br> "Occupation", "Relationship", "Race", "Sex", "Capital Gain", "Capital Loss",<br> "Hours per week", "Country"],<br> skiprows=1...
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,050
knn = KNeighborsClassifier(n_neighbors=34,p=1) knn.fit(Xadult,Yadult)
No
5
7
Model_Train
train_model
1,544,504
1
A
0
0
0
0
0
2
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
7
B
7,051
testAdult.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
7,052
YtestAdult = knn.predict(XtestAdult) YtestAdult
No
5
48
Model_Evaluation
predict_on_test
1,544,504
1
A
0
0
0
1
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"]
7
A
7,053
testAdult['Capital Gain'].plot()
No
5
33
Visualization
distribution
1,554,855
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"]
3
A
7,054
prediction = pd.DataFrame(testAdult.index) prediction["income"] = YtestAdult
Yes
4
12
Data_Transform
create_dataframe
1,544,504
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"]
7
A
7,055
prediction.to_csv("adult_prediction_5.csv", index=False)
No
5
25
Data_Export
save_to_csv
1,544,504
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"]
7
A
7,056
import pandas as pd import numpy as np import sklearn
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
7,057
adult = pd.read_csv("../input/adultdataset/train_data.csv",<br> names=[<br> "Age", "Workclass", "fnlwgt", "Education", "Education-Num", "Martial Status",<br> "Occupation", "Relationship", "Race", "Sex", "Capital Gain", "Capital Loss",<br> "Hours per week", "Country", "Target"],<br> se...
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,058
nTestAdult = testAdult.dropna() nTestAdult.shape
Yes
3
17
Data_Transform
correct_missing_values
1,554,855
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker"]
3
A
7,059
Xadult = nadult[["Age","Education-Num","Capital Gain", "Capital Loss", "Hours per week"]] Xadult.head()
No
4
41
Debug
show_table
1,554,855
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker"]
3
A
7,060
Yadult = nadult.Target
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,061
testAdult = pd.read_csv("../input/adultdataset/test_data.csv",<br> names=[<br> "id", "Age", "Workclass", "fnlwgt", "Education", "Education-Num", "Martial Status",<br> "Occupation", "Relationship", "Race", "Sex", "Capital Gain", "Capital Loss",<br> "Hours per week", "Country"],<br> sep...
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,062
from sklearn.neighbors import KNeighborsClassifier
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
7,063
knn = KNeighborsClassifier(n_neighbors=30)
No
5
4
Model_Train
choose_model_class
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,064
YtestPred = knn.predict(XtestAdult)
No
5
48
Model_Evaluation
predict_on_test
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,065
result = np.vstack((testAdult["id"], YtestPred)).T x = ["id","income"] Resultado = pd.DataFrame(columns = x, data = result) Resultado.to_csv("Resultados.csv", index = False) Resultado
Yes
3
25
Data_Export
save_to_csv
1,558,400
1
A
0
0
0
1
0
5
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
5
A
7,066
import os os.listdir('../input/adultb')
No
5
88
Debug
list_files
1,560,747
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/adultb. 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"]
5
A
7,067
adult=pd.read_csv(\'../input/adultb/train_data.csv\',<br> sep=\',\', engine=\'python\',<br> na_values="?")
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,068
nadult = adult.copy()
No
4
77
Other
define_variables
1,560,747
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
7,069
adult.isnull().sum()
No
4
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,070
Xadult = adult[['age','education.num', 'capital.gain','capital.loss', 'hours.per.week']]
No
5
21
Data_Transform
prepare_x_and_y
1,560,747
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A