id
int64
0
7.95k
code_block
stringlengths
1
52.9k
too_long
stringclasses
2 values
marks
int64
1
5
graph_vertex_id
float64
1
88
graph_vertex_class
stringclasses
12 values
graph_vertex_subclass
stringclasses
70 values
kernel_id
float64
25.8k
14.7M
⌀
sqale_rating
float64
1
4
maintainability_rating
stringclasses
4 values
code_smells
int64
0
36
complexity
float64
0
15
⌀
cognitive_complexity
int64
0
33
bugs
int64
0
7
sqale_index
int64
0
125
ncloc
float64
0
101
⌀
mlscent_analysis_status
stringclasses
3 values
mlscent_smell_count
int64
0
31
mlscent_unique_smell_count
int64
0
12
mlscent_findings_json
stringlengths
2
7.76k
mlscent_ml_rating
stringclasses
5 values
mlscent_ml_rating_basis
stringclasses
52 values
mlscent_ml_findings_json
stringclasses
50 values
mlscent_ignored_findings_json
stringclasses
199 values
context_line_count
int64
0
33
combined_rating
stringclasses
5 values
7,681
from sklearn.ensemble import RandomForestRegressor
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,682
rf = RandomForestRegressor(random_state=42, n_jobs=-1)
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,683
rf.fit(train[feats], train['rentals'])
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,684
train_preds = rf.predict(train[feats])
No
5
27
Model_Train
predict_on_train
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,685
mean_squared_error(train['rentals'], train_preds)**(1/2)
No
5
28
Model_Train
compute_train_metric
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,686
valid_preds = rf.predict(valid[feats])
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,687
mean_squared_error(valid['rentals'], valid_preds)**(1/2)
No
5
49
Model_Evaluation
compute_test_metric
2,146,505
1
A
0
0
0
1
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"]
6
A
7,688
test[['datetime', 'count']].to_csv('rf.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
7,689
# Prepare the train data train_data = process_data(train_images, TRAIN_DIR, isTrain=True) X = np.array([i[0] for i in train_data]).reshape(-1, IMG_SIZE, IMG_SIZE, 3) y = np.array([i[1] for i in train_data])
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,690
plot_accuracy_and_loss(history)
No
5
35
Visualization
learning_history
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,691
import numpy as np<br>import pandas as pd<br>import keras<br>from sklearn.preprocessing import LabelEncoder, StandardScaler, OneHotEncoder<br>from sklearn.model_selection import train_test_split<br>from sklearn.metrics import f1_score<br>from matplotlib import pyplot as plt<br>import os<br>import re<br>print(os.listdir...
No
5
88
Debug
list_files
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
7,692
df = pd.read_csv('../input/2TWH_train.csv', index_col='IDNum') for col in df: if col[0] == ' ': df = df.rename(columns={col : col[1:]}) dt = pd.read_csv('../input/test.csv', index_col='IDNum') for col in dt: if col[0] == ' ': dt = dt.rename(columns={col : col[1:]})
Yes
3
45
Data_Extraction
load_from_csv
2,172,412
1
A
0
4
6
0
0
8
ok
5
4
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Dependent Threshold Checker", "Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
6
A
7,693
df['Source IP'] = df['Source IP'].apply(to_int) df['Destination IP'] = df['Destination IP'].apply(to_int) df['Timestamp'] = df['Timestamp'].apply(to_int) df['Flow Bytes/s'] = df['Flow Bytes/s'].astype(float) df['Flow Packets/s'] = df['Flow Packets/s'].astype(float) dt['Source IP'] = dt['Source IP'].apply(to_int) dt[...
No
5
16
Data_Transform
data_type_conversions
2,172,412
3
C
4
0
0
0
32
10
ok
10
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"]
6
C
7,694
df = df.replace([np.inf, 'Infinity', 'infinity', 'inf'], 2**31-1) df = df.replace([np.nan, np.inf, 'NaN'], 0) dt = dt.replace([np.inf, 'Infinity', 'infinity', 'inf'], 2**31-1) dt = dt.replace([np.nan, 'NaN'], 0)
Yes
4
17
Data_Transform
correct_missing_values
2,172,412
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"]
6
A
7,695
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state = 42) ohe = OneHotEncoder(categories='auto') y_train_ohe = ohe.fit_transform(y_train.reshape(-1, 1)) y_test_ohe = ohe.fit_transform(y_test.reshape(-1, 1)) y_ohe = ohe.fit_transform(y.reshape(-1, 1)) scaler = StandardScaler() X_scale =...
Yes
3
13
Data_Transform
split
2,172,412
1
A
0
0
0
0
0
9
ok
17
8
[{"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...
B
Cross Validation Checker=low, Cross-validation not detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not 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"]
6
B
7,696
from keras import Sequential from keras.layers import Dense model = Sequential() model.add(Dense(units=20, activation='relu', input_dim=X.shape[1])) model.add(Dense(units=10, activation='relu')) model.add(Dense(units=3, activation='softmax')) model.compile(optimizer='rmsprop', loss='categorical_crossentro...
No
5
4
Model_Train
choose_model_class
2,172,412
1
A
0
0
0
0
0
9
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"]
6
A
7,697
history = model.fit(X_train_scale, y_train_ohe, epochs=1000, batch_size=8192, validation_data=(X_test_scale, y_test_ohe))
No
5
7
Model_Train
train_model
2,172,412
1
A
0
0
0
0
0
5
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"]
6
B
7,698
import matplotlib.pyplot as plt loss = history.history['loss'] val_loss = history.history['val_loss'] epochs = range(1, len(loss) + 1) plt.figure(figsize = (10, 10)) plt.semilogy(epochs, loss, 'bo', label='Training loss') plt.semilogy(epochs, val_loss, 'red', label='Validation loss') plt.title('Training and validation ...
No
5
35
Visualization
learning_history
2,172,412
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"]
6
A
7,699
plt.clf() history_dict = history.history acc_values = history_dict['acc'] val_acc_values = history_dict['val_acc'] plt.figure(figsize = (10, 10)) plt.semilogy(epochs, acc_values, 'bo', label='Training acc') plt.semilogy(epochs, val_acc_values, 'red', label='Validation acc') plt.title('Training and validation accuracy')...
No
5
35
Visualization
learning_history
2,172,412
1
A
0
0
0
0
0
12
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"]
6
A
7,700
# Load packages import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from tqdm import tqdm from random import shuffle import os, gc, time, cv2, random, math %matplotlib inline import warnings warnings.filterwarnings('ignore') #################### # Global Constants # #########...
No
4
77
Other
define_variables
2,180,506
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
1
null
7,701
# Plotting loss and accuracy for the model def plot_accuracy_and_loss(history): eval_res = pd.DataFrame(history.history) f, ax = plt.subplots(1,2, figsize=(18,5)) for i, c in enumerate(['acc', 'loss']): ax[i].plot(eval_res[[c]], label=f'Training {c}') ax[i].plot(eval_res[[f'val_{c}']], label...
No
5
35
Visualization
learning_history
null
1
A
1
2
1
0
5
10
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,702
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
7,703
import pandas as pd from pathlib import Path from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestRegressor from sklearn.linear_model import LinearRegression
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
7,704
data_dir = Path('../input') train_df = pd.read_csv(data_dir / 'train.csv') test_df = pd.read_csv(data_dir / 'test.csv') sample_submission = pd.read_csv(data_dir / 'sampleSubmission.csv')
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,705
print(train_df.shape) train_df.head()
Yes
3
58
Debug
show_shape
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,706
print(test_df.shape) test_df.head()
Yes
3
58
Debug
show_shape
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,707
features = ['open', 'high', 'low', 'close', 'volume', 'trades', 'macd', 'macd_hist', 'macd_signal', 'adx', 'di_plus', 'di_minus', 'rsi', 'cci', 'adl']
No
5
77
Other
define_variables
2,186,697
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
7,708
X_train = train_df[features] y_train = train_df['y'] X_test = test_df[features]
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,709
scaler = StandardScaler(with_std=False) X_train = scaler.fit_transform(X_train) X_test = scaler.transform(X_test)
No
5
18
Data_Transform
normalization
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,710
regressor = RandomForestRegressor(n_estimators=200, random_state=42, n_jobs=-1, max_depth=7) regressor.fit(X_train, y_train)
No
5
7
Model_Train
train_model
2,186,697
1
A
0
0
0
0
0
3
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"]
4
B
7,711
y_test = regressor.predict(X_test)
No
5
48
Model_Evaluation
predict_on_test
2,186,697
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"]
4
A
7,712
sample_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
7,713
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os print(os.listdir("../input"))
No
5
88
Debug
list_files
null
1
A
0
0
0
0
0
4
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 5"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
0
A
7,714
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression as LR from sklearn.metrics import mean_squared_error import lightgbm as lgb from sklearn.model_selection import GridSearchCV from sklearn.model_selection import RandomizedSearchC...
No
5
22
Environment
import_modules
2,189,923
1
A
0
0
0
0
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
10
A
7,715
import warnings warnings.filterwarnings("ignore")
No
5
23
Environment
set_options
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,716
data = pd.read_csv('../input/train.csv') target = data.pop('y') data_test = pd.read_csv('../input/test.csv')
No
5
45
Data_Extraction
load_from_csv
2,189,923
1
A
0
0
0
0
0
3
ok
3
2
[{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
10
A
7,717
out_df = pd.DataFrame(np.concatenate(preds_df), columns=['id','expected']) out_df.id = out_df.id.astype('int') out_df.to_csv('by_asset_lgbm.csv',index = False)
Yes
4
25
Data_Export
save_to_csv
2,189,923
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
10
A
7,718
out_df = pd.DataFrame(np.concatenate(grid_preds_df), columns=['id','expected']) out_df.id = out_df.id.astype('int') out_df.to_csv('grid_by_asset.csv',index = False)
Yes
4
25
Data_Export
save_to_csv
2,189,923
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
10
A
7,719
out_df = pd.DataFrame(np.concatenate(preds_df), columns=['id','expected']) out_df.id = out_df.id.astype('int') out_df.to_csv('Elastic_net.csv',index = False)
Yes
4
25
Data_Export
save_to_csv
2,189,923
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
10
A
7,720
data_dir = Path('../input') train_df = pd.read_csv(data_dir / 'train.csv') test_df = pd.read_csv(data_dir / 'test.csv') sample_submission = pd.read_csv(data_dir / 'sampleSubmission.csv') train_df['d'] = train_df['close'] / train_df['open'] test_df['d'] = test_df['close'] / test_df['open']
Yes
4
45
Data_Extraction
load_from_csv
2,191,512
1
A
0
0
0
0
0
6
ok
4
4
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 6"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection C...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Hardcoded file path", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
10
A
7,721
features = ['asset','di_minus', 'rsi', 'cci','volume'] features = ['asset', 'open', 'high', 'low', 'close', 'volume', 'trades', 'macd', 'macd_hist', 'macd_signal', 'adx', 'di_plus', 'di_minus', 'rsi', 'cci', 'adl']
No
5
77
Other
define_variables
2,191,512
1
A
0
0
0
0
0
5
ok
1
1
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 6"}]
A
no applicable ML-specific findings
[]
["Import Checker"]
10
A
7,722
X_train = train_df[features] y_train = train_df[['asset', 'y']] X_test = test_df[features]
No
5
21
Data_Transform
prepare_x_and_y
2,191,512
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 6"}]
A
no applicable ML-specific findings
[]
["Import Checker"]
10
A
7,723
from numpy import column_stack scaler = StandardScaler() X_train = pd.DataFrame(data=scaler.fit_transform(train_df[features]), columns=features) X_train['asset'] = train_df['asset'] X_test = pd.DataFrame(data=scaler.transform(test_df[features]), columns=features) X_test['asset'] = test_df['asset']
No
5
21
Data_Transform
prepare_x_and_y
2,191,512
1
A
0
0
0
0
0
6
ok
12
10
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 6"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
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", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
10
D
7,724
regressor = TssRegressor() regressor.fit(X_train, y_train) y_test = [item[1] for item in regressor.predict(X_test)] y_test[:12] = [0]*12 sample_submission['expected'] = y_test
Yes
3
7
Model_Train
train_model
2,191,512
1
A
0
0
0
0
0
5
ok
10
9
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 6"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection C...
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", "Exception Handling Checker", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
10
B
7,725
import pylab import calendar import numpy as np import pandas as pd import seaborn as sn from scipy import stats import missingno as msno from datetime import datetime import matplotlib.pyplot as plt import warnings pd.options.mode.chained_assignment = None warnings.filterwarnings("ignore", category=DeprecationWarning)...
No
5
23
Environment
set_options
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
7,726
dailyData = pd.read_csv("../input/train.csv")
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,727
dailyData.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,728
dailyData.head(2)
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,729
dailyData.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
7,730
dailyData["date"] = dailyData.datetime.apply(lambda x : x.split()[0])<br>dailyData["hour"] = dailyData.datetime.apply(lambda x : x.split()[1].split(":")[0])<br>dailyData["weekday"] = dailyData.date.apply(lambda dateString : calendar.day_name[datetime.strptime(dateString,"%Y-%m-%d").weekday()])<br>dailyData["month"] = d...
No
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
7,731
dailyData = dailyData.drop(["datetime"],axis=1)
No
5
10
Data_Transform
drop_column
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,732
fig, axes = plt.subplots(nrows=2,ncols=2)<br>fig.set_size_inches(12, 10)<br>sn.boxplot(data=dailyData,y="count",orient="v",ax=axes[0][0])<br>sn.boxplot(data=dailyData,y="count",x="season",orient="v",ax=axes[0][1])<br>sn.boxplot(data=dailyData,y="count",x="hour",orient="v",ax=axes[1][0])<br>sn.boxplot(data=dailyData,y="...
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
7,733
dailyDataWithoutOutliers = dailyData[np.abs(dailyData["count"]-dailyData["count"].mean())<=(3*dailyData["count"].std())]
No
5
14
Data_Transform
filter
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,734
print ("Shape Of The Before Ouliers: ",dailyData.shape) print ("Shape Of The After Ouliers: ",dailyDataWithoutOutliers.shape)
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,735
dataTrain = pd.read_csv("../input/train.csv") dataTest = 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
7,736
data = dataTrain.append(dataTest) data.reset_index(inplace=True) data.drop('index',inplace=True,axis=1)
Yes
4
10
Data_Transform
drop_column
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,737
data["date"] = data.datetime.apply(lambda x : x.split()[0]) data["hour"] = data.datetime.apply(lambda x : x.split()[1].split(":")[0]).astype("int") data["year"] = data.datetime.apply(lambda x : x.split()[0].split("-")[0]) data["weekday"] = data.date.apply(lambda dateString : datetime.strptime(dateString,"%Y-%m-%d").wee...
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,738
categoricalFeatureNames = ["season","holiday","workingday","weather","weekday","month","year","hour"]<br>numericalFeatureNames = ["temp","humidity","windspeed","atemp"]<br>dropFeatures = [\'casual\',"count","datetime","date","registered"]
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
7,739
for var in categoricalFeatureNames: data[var] = data[var].astype("category")
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
1
1
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,740
dataTrain = dataTrain.drop(dropFeatures,axis=1) dataTest = dataTest.drop(dropFeatures,axis=1)
No
5
10
Data_Transform
drop_column
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,741
from sklearn.linear_model import LinearRegression,Ridge,Lasso from sklearn.model_selection import GridSearchCV from sklearn import metrics import warnings pd.options.mode.chained_assignment = None warnings.filterwarnings("ignore", category=DeprecationWarning) # Initialize logistic regression model lModel = LinearRegre...
Yes
3
7
Model_Train
train_model
null
1
A
0
0
0
0
0
11
ok
8
7
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
0
B
7,742
from sklearn.ensemble import GradientBoostingRegressor gbm = GradientBoostingRegressor(n_estimators=4000,alpha=0.01); ### Test 0.41 yLabelsLog = np.log1p(yLabels) gbm.fit(dataTrain,yLabelsLog) preds = gbm.predict(X= dataTrain) print ("RMSLE Value For Gradient Boost: ",rmsle(np.exp(yLabelsLog),np.exp(preds),False))
Yes
3
7
Model_Train
train_model
null
2
B
2
0
0
0
10
6
ok
9
7
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
0
B
7,743
predsTest = gbm.predict(X= dataTest) fig,(ax1,ax2)= plt.subplots(ncols=2) fig.set_size_inches(12,5) sn.distplot(yLabels,ax=ax1,bins=50) sn.distplot(np.exp(predsTest),ax=ax2,bins=50)
No
5
56
Visualization
plot_predictions
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,744
submission = pd.DataFrame({<br> "datetime": datetimecol,<br> "count": [max(0, x) for x in np.exp(predsTest)]<br> })<br>submission.to_csv(\'bike_predictions_gbm_separate_without_fe.csv\', index=False)
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
7,745
import math import numpy as np import pandas as pd import matplotlib.pyplot as plt import time import os %matplotlib inline
No
5
23
Environment
set_options
2,213,549
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
7,746
train = pd.read_csv('../input/training/training.csv')
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,747
train.dropna(inplace=True)
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
7,748
train.tail(3)
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,749
test = pd.read_csv('../input/test/test.csv')
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,750
train.shape, test.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,751
x = np.stack(train.Image)[..., None]
No
5
11
Data_Transform
concatenate
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,752
x.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,753
x_t = np.stack(test.Image)[..., None]
No
5
11
Data_Transform
concatenate
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,754
x_t.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,755
from IPython.display import SVG from keras.models import Sequential from keras.layers import Dense, Activation, Dropout, Conv2D, MaxPool2D, Flatten, LeakyReLU, ELU from keras.callbacks import ModelCheckpoint, EarlyStopping from keras.utils.vis_utils import model_to_dot
No
5
22
Environment
import_modules
2,213,549
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,765
np.random.seed(777) model10 = Sequential() model10.add(Conv2D(filters = 64, kernel_size = (5,5), padding = 'Same', activation = 'relu', input_shape = (96, 96, 1))) model10.add(MaxPool2D(pool_size=(2,2), strides=(2,2))) model10.add(Dropout(0.3)) model10.add(Conv2D(filters = 32, kernel_size = (4,4), padding = 'Same', ...
No
5
4
Model_Train
choose_model_class
2,213,549
1
A
0
0
0
0
0
12
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,775
MODEL_DIR = '../model/'
No
5
77
Other
define_variables
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,776
modelpath = '../model/{epoch:02d}-{val_loss:4f}.hdf5'
No
5
77
Other
define_variables
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,786
predict = model10.predict(x)
No
5
27
Model_Train
predict_on_train
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,787
train_loss = history.history['loss'] val_loss = history.history['val_loss'] x_len = np.arange(len(train_loss)) plt.plot(x_len, train_loss, marker='.', c='red', label='Train_loss') plt.plot(x_len, val_loss, marker='.', c='blue', label='Val_loss') plt.legend(loc='upper right') plt.grid() plt.xlabel('epoch') plt.ylabel(...
No
5
35
Visualization
learning_history
2,213,549
1
A
0
0
0
0
0
10
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,788
y_t = model10.predict(x_t)
No
5
48
Model_Evaluation
predict_on_test
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,789
look_id = pd.read_csv('../input/IdLookupTable.csv')
No
5
45
Data_Extraction
load_from_csv
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,790
look_id.info()
No
5
40
Debug
show_table_attributes
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,791
look_id.drop('Location', axis=1, inplace=True)
No
5
10
Data_Transform
drop_column
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,792
look_id[['RowId','Location']].to_csv('Predict.csv',index=False)
No
5
25
Data_Export
save_to_csv
2,213,549
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,798
from xgboost import XGBClassifier import xgboost as xgb
No
5
22
Environment
import_modules
2,236,557
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,799
#for scaling from sklearn.preprocessing import StandardScaler
No
5
22
Environment
import_modules
2,236,557
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,800
data = pd.read_csv('../input/train.csv') test = pd.read_csv('../input/test.csv')
No
5
45
Data_Extraction
load_from_csv
2,236,557
1
A
0
0
0
0
0
2
ok
3
2
[{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
2
A
7,801
print(data.shape)
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,802
data.columns
No
5
71
Debug
show_columns
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,803
df=pd.concat([df,Date,Time],axis=1) #df #-----------test data------------------ df_test=pd.concat([df_test,Date_test,Time_test],axis=1)
No
5
11
Data_Transform
concatenate
2,236,557
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,804
df=df.drop(labels=['Dates'],axis=1) #-----------test data------------------ df_test=df_test.drop(labels=['Dates'],axis=1)
No
5
10
Data_Transform
drop_column
2,236,557
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,805
df.columns
No
5
71
Debug
show_columns
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
7,806
df["rot60_X"]=(0.5) * df["Y"] + (1.732/2) * df["X"] df["rot60_Y"]=0.5 * df["Y"] - (1.732/2) * df["X"] df_test["rot60_X"]=(0.5) * df_test["Y"] + (1.732/2) * df_test["X"] df_test["rot60_Y"]=0.5 * df_test["Y"] - (1.732/2) * df_test["X"] df["rot45_X"]=0.707 * df["Y"] + 0.707 * df["X"] df["rot45_Y"]=0.707 * df["Y"] - 0....
No
5
8
Data_Transform
feature_engineering
2,236,557
1
A
0
0
0
0
0
12
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,807
df["radial60"]=np.sqrt(np.power(df[\'rot60_X\'],2) + np.power(df[\'rot60_Y\'],2))<br><br>df_test["radial60"]=np.sqrt(np.power(df_test[\'rot60_X\'],2) + np.power(df_test[\'rot60_Y\'],2))
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
7,808
df=df.drop(labels='rot60_X',axis=1) df_test=df_test.drop(labels='rot60_X',axis=1)
No
5
10
Data_Transform
drop_column
2,236,557
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,809
df=df.drop(labels='rot60_Y',axis=1) df_test=df_test.drop(labels='rot60_Y',axis=1)
No
5
10
Data_Transform
drop_column
2,236,557
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,810
df=df.drop(labels='Second',axis=1) df_test=df_test.drop(labels='Second',axis=1)
No
5
10
Data_Transform
drop_column
2,236,557
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,811
df['Minute']=df['Minute'].apply(lambda x:int(x)) df['Minute']=df['Minute'].apply(lambda x : 'low' if x <31 else 'high') df_test['Minute']=df_test['Minute'].apply(lambda x:int(x)) df_test['Minute']=df_test['Minute'].apply(lambda x : 'low' if x <31 else 'high')
No
5
8
Data_Transform
feature_engineering
2,236,557
1
A
0
2
2
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
7,812
df['DayOfWeek']= df['DayOfWeek'].apply(lambda x : 'WeekHigh' if x in ('Wednesday','Friday') else ('WeekMed' if x in ('Tuesday','Thursday','Saturday') else 'WeekLow')) df_test['DayOfWeek']= df_test['DayOfWeek'].apply(lambda x : 'WeekHigh' if x in ('Wednesday','Friday') else ('WeekMed' if x in ('Tuesday','Thursday','Sa...
No
5
8
Data_Transform
feature_engineering
2,236,557
3
C
2
4
6
0
10
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
C