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
1,648
import tensorflow as tf
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
1,649
train_data = pd.read_csv("gap-development.tsv", sep = "\\t") validation_data = pd.read_csv("gap-validation.tsv", sep = "\\t") test_data = pd.read_csv("gap-test.tsv", sep = "\\t")'
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
1,650
merge_data = pd.concat([train_data,validation_data]).reset_index(drop = True) merge_data = pd.concat([merge_data,train_data]).reset_index(drop = True) count = 0
No
5
11
Data_Transform
concatenate
3,544,896
1
A
0
0
0
0
0
3
ok
4
4
[{"detector": "framework_specific", "framework": "Pandas", "name": "Merge Parameter Checker", "fix": "Specify how, on, and validate parameters in merge operations.", "benefits": "Ensures accurate data merging and prevents data loss.", "location": "Line 10"}, {"detector": "framework_specific", "framework": "ScikitLearn"...
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"}]
["Merge Parameter Checker"]
7
B
1,651
def name_replace(s, r1, r2): s = str(s).replace(r1,r2) for r3 in r1.split(' '): s = str(s).replace(r3,r2) return s def shortest_dependency_path(doc, e1=None, e2=None): edges = [] for token in doc: for child in token.children: edges.append(('{0}'.format(token), ...
Yes
2
53
Other
something_strange
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,652
feature = get_features(merge_data)
No
5
8
Data_Transform
feature_engineering
3,544,896
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
1,653
feature
No
5
53
Other
something_strange
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,654
Y = merge_data[["A-coref", "B-coref"]] Y.columns = ["A","B"] Y["A"] = Y["A"].astype(int) Y["B"] = Y["B"].astype(int) Y["NEITHER"] = 1- (Y["A"] + Y["B"])
No
4
16
Data_Transform
data_type_conversions
3,544,896
1
A
0
0
0
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
1,655
from sklearn import * from sklearn.ensemble import RandomForestClassifier from sklearn.tree import DecisionTreeClassifier import xgboost as xgb from xgboost import XGBClassifier from sklearn.preprocessing import StandardScaler x1, x2, y1, y2 = model_selection.train_test_split(feature.fillna(-1), Y, test_size=0.2, rando...
No
4
22
Environment
import_modules
3,544,896
1
A
1
0
0
1
5
10
ok
2
2
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Model Evaluation Checker", "fix": "Evaluate model performance using model.evaluate().", "benefits": "Provides standardized model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Model Evaluation Checker"]
7
B
1,656
scaler = StandardScaler() x1 = scaler.fit_transform(x1) x2 = scaler.transform(x2) model = multiclass.OneVsRestClassifier(ensemble.RandomForestClassifier(max_depth = 7, n_estimators=1000, random_state=33)) # model = multiclass.OneVsRestClassifier(ensemble.ExtraTreesClassifier(n_jobs=-1, n_estimators=100, random_state=33...
No
3
18
Data_Transform
normalization
3,544,896
2
B
2
0
0
0
10
6
ok
16
11
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Memory Release Checker", "fix": "Clear session after model creation/training using tf.keras.backend.clear_session().", "benefits": "Prevents memory leaks and reduces resource usage.", "location": ""}, {"detector": "framework_specific", "framework":...
D
Cross Validation Checker=low, Cross-validation not detected=low, Data Leakage Checker=high, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "Pipeline Checker", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Logging Checker", "Memory Release Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
7
D
1,657
final_test = pd.read_csv("../input/gendered-pronoun-resolution/test_stage_2.tsv", sep = "\\t") feature = get_features(final_test) print(feature) '
No
3
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
1,658
feature = feature.fillna(-1) # feature = scaler.transform(feature) print(feature)
No
4
17
Data_Transform
correct_missing_values
3,544,896
2
B
1
0
0
0
5
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
B
1,659
Y = pd.DataFrame(model.predict_proba(feature).tolist(), columns=["A","B", "NEITHER"]) r = final_test[["ID"]] submission = pd.concat([r,Y], axis = 1)
No
3
12
Data_Transform
create_dataframe
3,544,896
1
A
0
0
0
0
0
3
ok
7
6
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Memory Release Checker", "fix": "Clear session after model creation/training using tf.keras.backend.clear_session().", "benefits": "Prevents memory leaks and reduces resource usage.", "location": ""}, {"detector": "framework_specific", "framework":...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Memory Release Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
7
B
1,660
print(submission) submission.to_csv('submission.csv', index=False)
No
4
25
Data_Export
save_to_csv
3,544,896
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
1,661
!ls ../input
No
5
88
Debug
list_files
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,662
import time import os import random import numpy as np import pandas as pd import torch from torch.optim import Adam from torch.utils.data import Dataset from torch.nn import Module, Linear, Dropout import torch.nn.functional as F from pytorch_pretrained_bert.modeling import BertModel, BertLayer from pytorch_pretrain...
No
5
22
Environment
import_modules
3,577,796
1
A
0
0
0
0
0
18
ok
1
1
[{"detector": "framework_specific", "framework": "PyTorch", "name": "Deterministic Algorithm Usage Checker", "fix": "Enable deterministic algorithms using torch.use_deterministic_algorithms(True).", "benefits": "Ensures consistent results across different hardware and runs.", "location": ""}]
B
Deterministic Algorithm Usage Checker=low
[{"type": "Deterministic Algorithm Usage Checker", "severity": "low"}]
[]
10
B
1,663
# Model bert_model = "bert-large-cased" n_bertlayers = 22 dropout = 0.1 # Preprocessing do_lower_case = False # Training train_batch_size = 4 gradient_accumulation_steps = 5 lr = 1e-5 num_train_epochs = 2 warmup_proportion = 0.1 optim = "bertadam" weight_decay = False # Others n_models = 10 eval_batch_size = 32 de...
No
4
59
Model_Train
init_hyperparams
3,577,796
1
A
0
0
0
0
0
15
ok
9
2
[{"detector": "framework_specific", "framework": "PyTorch", "name": "Deterministic Algorithm Usage Checker", "fix": "Enable deterministic algorithms using torch.use_deterministic_algorithms(True).", "benefits": "Ensures consistent results across different hardware and runs.", "location": ""}, {"detector": "general_ml",...
B
Deterministic Algorithm Usage Checker=low
[{"type": "Deterministic Algorithm Usage Checker", "severity": "low"}]
["Magic number"]
10
B
1,664
mf = '../input/fork-of-fork-of-densenet201/model.hdf5' import os os.system('ls '+mf)
No
5
88
Debug
list_files
3,663,832
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/fork-of-fork-of-densenet201/model.hdf5. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
3
A
1,665
plt.figure(figsize=(16,8)) for i,country in enumerate(list_countries): Fatal_diff=Fatal_pivot[(Fatal_pivot[country]>0)][country].diff().fillna(0) Fatal_diff=Fatal_diff[Fatal_diff>0] Fatal_diff.plot(color=colors[i],label=country,lw=5) plt.title('Number of daily new Fatalities',fontsize=15) plt.legend...
No
5
33
Visualization
distribution
8,604,602
1
A
0
1
1
0
0
8
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
1,666
# all prediction is correct y_pred = [ [0., 1.], [1., 0.], [1., 0.], [0., 1.] ] log_loss(y_true, y_pred)
No
5
84
Other
not_enough_vertices
3,127,294
1
A
0
0
0
0
0
7
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,667
# all prediction is wrong y_pred = [ [1., 0.], [0., 1.], [0., 1.], [1., 0.] ] log_loss(y_true, y_pred)
No
5
49
Model_Evaluation
compute_test_metric
3,127,294
1
A
0
0
0
0
0
7
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,668
samples = df.sample(n=10, random_state=100) for _, s in samples.iterrows(): display_entry(s)
No
4
41
Debug
show_table
3,127,294
1
A
0
1
1
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,669
import spacy nlp = spacy.load('en_core_web_lg') displacy.render(nlp(samples.iloc[-2]['Text']), style='dep', jupyter=True, options={'distance': 150})
No
4
22
Environment
import_modules
3,127,294
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,670
# following: https://www.kaggle.com/keyit92/end2end-coref-resolution-by-attention-rnn/data train_df = read_df("../input/googlegapcoreference/gap-test.tsv") test_df = read_df("../input/googlegapcoreference/gap-development.tsv") dev_df = read_df("../input/googlegapcoreference/gap-validation.tsv")
No
5
45
Data_Extraction
load_from_csv
3,127,294
1
A
0
0
0
0
0
3
ok
3
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/googlegapcoreference/gap-test.tsv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 8"}, {"detector": "general_ml", "framework": "Ge...
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
5
A
1,671
print(f"Train: {train_df.shape}\ Test: {test_df.shape}\ Development: {dev_df.shape}")'
No
5
58
Debug
show_shape
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,672
sample = train_df.sample(random_state=555) display_entry(sample.iloc[0])
No
5
41
Debug
show_table
3,127,294
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}]
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
[]
5
B
1,673
# just testing if there is any entry with more than one answer train_df[train_df[['A-coref', 'B-coref']].sum(axis=1) > 1]
No
4
41
Debug
show_table
3,127,294
1
A
0
0
0
0
0
1
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
1,674
# adding a column with the answer def get_answer(row): if row['A-coref']: return 'A' if row['B-coref']: return 'B' return 'NEITHER' train_df['answer'] = train_df.apply(get_answer, axis=1)
No
5
8
Data_Transform
feature_engineering
3,127,294
1
A
0
3
2
0
0
7
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": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Missing function docstring"]
5
B
1,675
train_df['Text-length'].hist()
No
5
33
Visualization
distribution
3,127,294
1
A
0
0
0
0
0
1
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"]
5
B
1,676
train_df.groupby(pd.qcut(train_df['Text-length'], q=[0, .25, .5, .75, 1.]))['answer'].value_counts().unstack()
No
5
60
Data_Transform
groupby
3,127,294
1
A
0
0
0
0
0
1
ok
4
4
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker"]
5
B
1,677
train_df_A = train_df[train_df['answer'] == 'A'] train_df_B = train_df[train_df['answer'] == 'B'] train_df_NEITHER = train_df[train_df['answer'] == 'NEITHER'] X_A_A = train_df_A.rename(columns={ 'A': 'RE', 'A-offset': 'RE-offset', 'A-offset-end': 'RE-offset-end' })[['Text', 'Pronoun', 'RE', 'RE-offset', 'R...
Yes
3
61
Data_Transform
rename_columns
3,127,294
1
A
0
0
0
0
0
46
ok
4
4
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker"]
5
B
1,678
X_df.shape
No
5
58
Debug
show_shape
3,127,294
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,679
X_df.sample(random_state=1)
No
5
41
Debug
show_table
3,127,294
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,680
from textacy import similarity def add_features(df, re_col, inplace=False): if inplace: df_ = df else: df_ = df.copy() df_['URL_last_part'] = df_['URL'].str.rsplit('/', n=1, expand=True)[1].apply(preprocess_so) df_['URL_distance_jaro_winkler'] = df_.apply(lambda row: simi...
No
4
8
Data_Transform
feature_engineering
3,127,294
1
A
0
2
2
0
0
13
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": "general_ml", "framework": "General ML", "name": "Hardcoded file path d...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Hardcoded file path", "Missing function docstring"]
5
A
1,681
X_df.hist(column='URL_distance_jaro_winkler', by='y', figsize=(20, 5), bins=20, sharey=True)
No
5
33
Visualization
distribution
3,127,294
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,682
X_df.hist(column='URL_distance_levenshtein', by='y', figsize=(20, 5), bins=20, sharey=True)
No
5
33
Visualization
distribution
3,127,294
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,683
X_df.hist(column='URL_distance_token_sort_ratio', by='y', figsize=(20, 5), bins=20, sharey=True)
No
5
33
Visualization
distribution
3,127,294
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
1,684
from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split X = X_df[['URL_distance_token_sort_ratio', 'URL_distance_levenshtein', 'URL_distance_jaro_winkler', 'Text-length', 'referred-expression']] y = X_df['y'] X_train, X_test, y_train, y_test = train_test_split(X, y, test...
Yes
4
21
Data_Transform
prepare_x_and_y
3,127,294
1
A
0
0
0
0
0
11
ok
7
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not 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"]
5
B
1,685
import numpy as np def transform_to_submit(y_pred_, referred_expression): y_pred_comp = 1 - y_pred_ all_zero = np.zeros_like(y_pred_).reshape((-1, 1)) y_pred = np.hstack(( np.where(referred_expression == 'A', y_pred_, y_pred_comp).reshape((-1, 1)), np.where(referred_ex...
No
4
55
Data_Export
prepare_output
3,127,294
1
A
3
1
0
0
10
16
ok
7
4
[{"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
[]
["Array Creation Efficiency", "Exception Handling Checker", "Missing function docstring", "Unit Testing Checker"]
5
A
1,686
y_true
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
1,687
X_features = X.drop(columns='referred-expression') X_referred_expression = X['referred-expression'] lr.fit(X_features, y)
Yes
3
7
Model_Train
train_model
3,127,294
1
A
0
0
0
0
0
3
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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
5
B
1,688
df_A = add_features(df, 'A', inplace=False)[['URL_distance_token_sort_ratio', 'URL_distance_levenshtein', 'URL_distance_jaro_winkler', 'Text-length']] df_B = add_features(df, 'B', inplace=False)[['URL_distance_token_sort_ratio', 'URL_distance_levenshtein', 'URL_distance_jaro_winkler', 'Text-length']] y_pred_A = lr.pre...
Yes
3
27
Model_Train
predict_on_train
3,127,294
1
A
0
0
0
0
0
12
ok
10
7
[{"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": "Unit Testing...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Array Creation Efficiency", "Column Selection Checker", "Exception Handling Checker", "Magic number", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
5
B
1,689
import numpy as np import pandas as pd import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename))
No
5
88
Debug
list_files
null
1
A
0
2
3
0
0
6
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/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
1,690
os.environ["SEED"] = "420" import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader from transformers import BertModel, BertTokenizer, AdamW, get_linear_schedule_with_warmup, BertConfig import re from tqdm import tqdm
No
5
23
Environment
set_options
11,400,829
1
A
0
0
0
0
0
7
ok
2
2
[{"detector": "framework_specific", "framework": "PyTorch", "name": "Deterministic Algorithm Usage Checker", "fix": "Enable deterministic algorithms using torch.use_deterministic_algorithms(True).", "benefits": "Ensures consistent results across different hardware and runs.", "location": ""}, {"detector": "hugging_face...
B
Deterministic Algorithm Usage Checker=low
[{"type": "Deterministic Algorithm Usage Checker", "severity": "low"}]
["Efficient data loading not detected"]
6
B
1,691
df_train = pd.read_csv("/kaggle/input/gapvalidation/gap-test.tsv", delimiter="\\t") df_val = pd.read_csv("/kaggle/input/gapvalidation/gap-validation.tsv", delimiter="\\t") df_test = pd.read_csv("/kaggle/input/gapvalidation/gap-development.tsv", delimiter="\\t") test_2 = pd.read_csv("/kaggle/input/gendered-pronoun-resol...
No
4
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
1,692
tokenizer.add_tokens(['[A]', '[B]', '[P]']) def insert_tag(row): to_be_inserted = sorted([ (row["A-offset"], " [A] "), (row["B-offset"], " [B] "), (row["Pronoun-offset"], " [P] ") ], key=lambda x: x[0], reverse=True) text = row["Text"] for offset, tag in to_be_inserted: t...
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
1,693
class modified_dataset(torch.utils.data.Dataset): def __init__(self, df, tokenizer): p_text = [] offsets = [] at_mask = [] self.y_lst = df[['A-coref', 'B-coref']].apply(lambda row: target(row), axis = 1) for row in tqdm(range(len(df))): tokens, offset = tokenize(i...
Yes
3
44
Data_Extraction
load_from_disk
11,400,829
1
A
2
10
2
6
2
70
ok
2
2
[{"detector": "framework_specific", "framework": "PyTorch", "name": "Deterministic Algorithm Usage Checker", "fix": "Enable deterministic algorithms using torch.use_deterministic_algorithms(True).", "benefits": "Ensures consistent results across different hardware and runs.", "location": ""}, {"detector": "framework_sp...
B
Deterministic Algorithm Usage Checker=low, Randomness Control Checker (PyTorch-Dataloader)=low
[{"type": "Deterministic Algorithm Usage Checker", "severity": "low"}, {"type": "Randomness Control Checker (PyTorch-Dataloader)", "severity": "low"}]
[]
6
B
1,694
subs = df_weo['Subject Descriptor'].unique()[:-1] df_weo_agg = df_weo[['Country']][df_weo['Country'].duplicated()==False].reset_index(drop=True) for sub in subs[:]: df_tmp = df_weo[['Country', '2019']][df_weo['Subject Descriptor']==sub].reset_index(drop=True) df_tmp = df_tmp[df_tmp['Country'].duplicated()==Fal...
No
3
14
Data_Transform
filter
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,695
# merge df_traintest5 = pd.merge(df_traintest4, df_weo_agg, on='Country_Region', how='left') print(df_traintest5.shape) df_traintest5.head()
No
3
32
Data_Transform
merge
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,696
# add Life expectancy # Life expectancy at birth obtained from http://hdr.undp.org/en/data df_life = pd.read_csv("../input/smokingstats/Life expectancy at birth.csv") tmp = df_life.iloc[:,1].values.tolist() df_life = df_life[['Country', '2018']] def func(x): x_new = 0 try: x_new = float(x.replace(",", "...
Yes
2
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
1,697
df_life = df_life[['Country', '2018']] df_life.columns = ['Country_Region', 'LifeExpectancy']
No
3
14
Data_Transform
filter
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,698
# merge df_traintest6 = pd.merge(df_traintest5, df_life, on='Country_Region', how='left') print(len(df_traintest6)) df_traintest6.head()
No
4
32
Data_Transform
merge
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,699
# add additional info from countryinfo dataset df_country = pd.read_csv("../input/countryinfo/covid19countryinfo.csv") df_country.head()
No
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
1,700
df_country['Country_Region'] = df_country['country'] df_country = df_country[df_country['country'].duplicated()==False]
No
3
19
Data_Transform
remove_duplicates
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,701
print(df_country[df_country['country'].duplicated()].shape)
No
5
38
EDA
count_duplicates
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,702
df_country[df_country['country'].duplicated()]
No
2
38
EDA
count_duplicates
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,703
df_traintest7 = pd.merge(df_traintest6, df_country.drop(['tests', 'testpop', 'country'], axis=1), on=['Country_Region',], how='left') print(df_traintest7.shape) df_traintest7.head()
No
3
32
Data_Transform
merge
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,704
def encode_label(df, col, freq_limit=0): df[col][pd.isna(df[col])] = 'nan' tmp = df[col].value_counts() cols = tmp.index.values freq = tmp.values num_cols = (freq>=freq_limit).sum() print("col: {}, num_cat: {}, num_reduced: {}".format(col, len(cols), num_cols)) col_new = '{}_le'.format(col)...
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
1,705
df_traintest8['cases/day'] = df_traintest8['cases/day'].astype(np.float) df_traintest8['fatal/day'] = df_traintest8['fatal/day'].astype(np.float)
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,706
# covert object type to float def func(x): x_new = 0 try: x_new = float(x.replace(",", "")) except: # print(x) x_new = np.nan return x_new cols = [ 'Gross_domestic_product__constant_prices', 'Gross_domestic_product__current_prices', 'Gross_domestic_product__deflator...
No
3
16
Data_Transform
data_type_conversions
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,707
df_traintest8[df_traintest8['place_id']=='China/Hubei'].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
1,708
for col in df_traintest8.columns: print("'{}',".format(col))'
No
5
71
Debug
show_columns
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,709
day_before_valid = 71 # 3-11 day before of validation day_before_public = 78 # 3-18 last day of train day_before_launch = 85 # 4-1 last day before launch
No
2
23
Environment
set_options
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,710
def calc_score(y_true, y_pred): y_true[y_true<0] = 0 score = metrics.mean_squared_error(np.log(y_true.clip(0, 1e10)+1), np.log(y_pred[:]+1))**0.5 return score
No
5
84
Other
not_enough_vertices
null
1
A
0
1
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,711
# train model to predict fatalities/day # params SEED = 42 params = {'num_leaves': 8, 'min_data_in_leaf': 5, # 42, 'objective': 'regression', 'max_depth': 8, 'learning_rate': 0.02, 'boosting': 'gbdt', 'bagging_freq': 5, # 5 'bagging_fraction': 0.8,...
No
5
59
Model_Train
init_hyperparams
null
1
A
0
0
0
0
0
20
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,712
# train model to predict fatalities/day # features are selected manually based on valid score col_target = 'fatal/day' col_var = [ 'Lat', 'Long', 'days_since_1cases', # 'days_since_10cases', # 'days_since_100cases', # 'days_since_1fatal', # 'days_since_10fatal', 'days_since_100fatal', # '...
No
4
13
Data_Transform
split
8,687,249
1
A
0
0
0
0
0
63
ok
6
5
[{"detector": "framework_specific", "framework": "Pandas", "name": "DataFrame Conversion Checker", "fix": "Use .to_numpy() instead of .values.", "benefits": "Ensures future compatibility and avoids unexpected behaviour.", "location": "Line 75"}, {"detector": "framework_specific", "framework": "Pandas", "name": "DataFra...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "DataFrame Conversion Checker", "Hardcoded file path"]
3
B
1,713
y_true = df_valid['fatal/day'].values y_pred = np.exp(model.predict(X_valid))-1 score = calc_score(y_true, y_pred) print("{:.6f}".format(score))'
No
4
28
Model_Train
compute_train_metric
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,714
# display feature importance tmp = pd.DataFrame() tmp["feature"] = col_var tmp["importance"] = model.feature_importance() tmp = tmp.sort_values('importance', ascending=False) tmp.head(30)'
No
4
79
Visualization
model_coefficients
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,715
# train with all data before public df_train = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] df_valid = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] df_test = df_traintest8[pd.isna(df_traintest8['ForecastId'])==Fals...
No
4
7
Model_Train
train_model
null
1
A
0
0
0
0
0
12
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,716
# train model to predict fatalities/day col_target2 = 'cases/day' col_var2 = [ 'Lat', 'Long', 'days_since_1cases', # 'days_since_10cases', # 'days_since_100cases', # 'days_since_1fatal', # 'days_since_10fatal', 'days_since_100fatal', # 'cases/day_(1-1)', # 'cases/day_(1-7)', # '...
No
4
13
Data_Transform
split
8,687,249
1
A
0
0
0
0
0
61
ok
6
5
[{"detector": "framework_specific", "framework": "Pandas", "name": "DataFrame Conversion Checker", "fix": "Use .to_numpy() instead of .values.", "benefits": "Ensures future compatibility and avoids unexpected behaviour.", "location": "Line 72"}, {"detector": "framework_specific", "framework": "Pandas", "name": "DataFra...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "DataFrame Conversion Checker", "Hardcoded file path"]
3
B
1,717
# display feature importance tmp = pd.DataFrame() tmp["feature"] = col_var2 tmp["importance"] = model2.feature_importance() tmp = tmp.sort_values('importance', ascending=False) tmp.head(30)'
No
3
79
Visualization
model_coefficients
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,718
y_true = df_valid['cases/day'].values y_pred = np.exp(model2.predict(X_valid))-1 score = calc_score(y_true, y_pred) print("{:.6f}".format(score)) '
No
4
28
Model_Train
compute_train_metric
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,719
df_train = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] df_valid = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] X_train = df_train[col_var2] X_valid = df_valid[col_var2] y_train = np.log(df_train[col_target2].value...
No
3
7
Model_Train
train_model
null
1
A
0
0
0
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,720
# train model to predict fatalities/day df_train = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] df_valid = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (day_before_public<df_traintest8['day'])] df_test = df_traintest8[pd.isna(df_traintest8['ForecastId'])==F...
No
2
13
Data_Transform
split
null
1
A
0
0
0
0
0
14
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,721
# train with all data df_train = df_traintest8[(pd.isna(df_traintest8['ForecastId']))] df_valid = df_traintest8[(pd.isna(df_traintest8['ForecastId']))] X_train = df_train[col_var] X_valid = df_valid[col_var] y_train = np.log(df_train[col_target].values.clip(0, 1e10)+1) y_valid = np.log(df_valid[col_target].values.clip(...
No
3
7
Model_Train
train_model
null
1
A
0
0
0
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,722
# train model to predict cases/day df_train = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] df_valid = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (day_before_public<df_traintest8['day'])] X_train = df_train[col_var2] X_valid = df_valid[col_var2] y_train = ...
No
2
13
Data_Transform
split
null
1
A
0
0
0
0
0
12
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,723
# train with all data df_train = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] df_valid = df_traintest8[(pd.isna(df_traintest8['ForecastId'])) & (df_traintest8['day']<=day_before_public)] X_train = df_train[col_var2] X_valid = df_valid[col_var2] y_train = np.log(df_tr...
No
3
7
Model_Train
train_model
null
1
A
0
0
0
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,724
# remove overlap for public LB prediction df_tmp = df_traintest8[ ((df_traintest8['day']<=day_before_public) & (pd.isna(df_traintest8['ForecastId']))) | ((day_before_public<df_traintest8['day']) & (pd.isna(df_traintest8['ForecastId'])==False))].reset_index(drop=True) df_tmp = df_tmp.drop([ 'cases/day_(1-1)...
No
5
14
Data_Transform
filter
null
1
A
0
1
1
0
0
16
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,725
# remove overlap for private LB prediction df_tmp = df_traintest8[ ((df_traintest8['day']<=day_before_private) & (pd.isna(df_traintest8['ForecastId']))) | ((day_before_private<df_traintest8['day']) & (pd.isna(df_traintest8['ForecastId'])==False))].reset_index(drop=True) df_tmp = df_tmp.drop([ 'cases/day_(1...
No
4
14
Data_Transform
filter
null
1
A
0
1
1
0
0
16
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,726
# predict test data in public # predict the cases and fatatilites one day at a time and use the predicts as next day's feature recursively. df_preds = [] for i, place in enumerate(places[:]): df_interest = copy.deepcopy(df_traintest9[df_traintest9['place_id']==place].reset_index(drop=True)) df_interest['cases/d...
Yes
2
27
Model_Train
predict_on_train
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,727
# predict test data in public df_preds_pri = [] for i, place in enumerate(places[:]): df_interest = copy.deepcopy(df_traintest10[df_traintest10['place_id']==place].reset_index(drop=True)) df_interest['cases/day'][(pd.isna(df_interest['ForecastId']))==False] = -1 df_interest['fatal/day'][(pd.isna(df_interest...
Yes
2
27
Model_Train
predict_on_train
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,728
places_sort = df_traintest10[['place_id', 'ConfirmedCases']][df_traintest10['day']==day_before_private] places_sort = places_sort.sort_values('ConfirmedCases', ascending=False).reset_index(drop=True)['place_id'].values print(len(places_sort)) places_sort[:5]
No
3
9
Data_Transform
sort_values
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,729
print("Fatalities / Public") plt.figure(figsize=(30,30)) for i in range(30): plt.subplot(5,6,i+1) idx = i * 10 df_interest = df_preds[df_preds['place_id']==places_sort[idx]].reset_index(drop=True) tmp = df_interest['fatal/day'].values tmp = np.cumsum(tmp) sns.lineplot(x=df_interest['day'], y=tmp...
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
1,730
print("Confirmed Cases / Public") plt.figure(figsize=(30,30)) for i in range(30): plt.subplot(5,6,i+1) idx = i * 10 df_interest = df_preds[df_preds['place_id']==places_sort[idx]].reset_index(drop=True) tmp = df_interest['cases/day'].values tmp = np.cumsum(tmp) sns.lineplot(x=df_interest['day'], ...
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
1,731
print("Fatalities / Private") plt.figure(figsize=(30,30)) for i in range(30): plt.subplot(5,6,i+1) idx = i * 10 df_interest = df_preds_pri[df_preds_pri['place_id']==places_sort[idx]].reset_index(drop=True) tmp = df_interest['fatal/day'].values tmp = np.cumsum(tmp) sns.lineplot(x=df_interest['day...
No
3
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,732
print("ConfirmedCases / Private") plt.figure(figsize=(30,30)) for i in range(30): plt.subplot(5,6,i+1) idx = i * 10 df_interest = df_preds_pri[df_preds_pri['place_id']==places_sort[idx]].reset_index(drop=True) tmp = df_interest['cases/day'].values tmp = np.cumsum(tmp) sns.lineplot(x=df_interest[...
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
1,733
# merge 2 preds df_preds[df_preds['day']>day_before_private] = df_preds_pri[df_preds['day']>day_before_private]
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
1,734
df_preds.to_csv("df_preds.csv", index=None)
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
1,735
# load sample submission df_sub = pd.read_csv("../input/covid19-global-forecasting-week-2/submission.csv") print(len(df_sub)) df_sub.head()
No
3
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,736
# merge prediction with sub df_sub = pd.merge(df_sub, df_traintest3[['ForecastId', 'place_id', 'day']]) df_sub = pd.merge(df_sub, df_preds[['place_id', 'day', 'cases_pred', 'fatal_pred']], on=['place_id', 'day',], how='left') df_sub.head(10)
No
4
32
Data_Transform
merge
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,737
# save df_sub['ConfirmedCases'] = df_sub['cases_pred'] df_sub['Fatalities'] = df_sub['fatal_pred'] df_sub = df_sub[['ForecastId', 'ConfirmedCases', 'Fatalities']] df_sub.to_csv("submission.csv", index=None) df_sub.head(10)'
No
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
1,738
%matplotlib inline
Yes
3
22
Environment
import_modules
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,739
# Imports # pandas import pandas as pd from pandas import Series,DataFrame # numpy, matplotlib, seaborn import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid') %matplotlib inline # machine learning from sklearn.linear_model import LinearRegression from sklearn.linear_model...
No
5
23
Environment
set_options
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
1,740
# get rossmann, store, & test csv files as a DataFrame rossmann_df = pd.read_csv("../input/train.csv") store_df = pd.read_csv("../input/store.csv") test_df = pd.read_csv("../input/test.csv") # preview the data rossmann_df.head()
No
4
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
1,741
rossmann_df.info() print("----------------------------") store_df.info() print("----------------------------") test_df.info()
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,742
# Open fig, (axis1) = plt.subplots(1,1,figsize=(15,4)) sns.countplot(x='Open',hue='DayOfWeek', data=rossmann_df,palette="husl", ax=axis1) # fill NaN values in test_df with Open=1 if DayOfWeek != 7 test_df["Open"][test_df["Open"] != test_df["Open"]] = (test_df["DayOfWeek"] != 7).astype(int) # Drop Open column # rossma...
Yes
2
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
1
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,743
# Date # Create Year and Month columns rossmann_df['Year'] = rossmann_df['Date'].apply(lambda x: int(str(x)[:4])) rossmann_df['Month'] = rossmann_df['Date'].apply(lambda x: int(str(x)[5:7])) test_df['Year'] = test_df['Date'].apply(lambda x: int(str(x)[:4])) test_df['Month'] = test_df['Date'].apply(lambda x: int(str...
Yes
2
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
13
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,744
# .... contiune with Date # Plot average sales & customers for every year fig, (axis1,axis2) = plt.subplots(1,2,figsize=(15,4)) sns.barplot(x='Year', y='Sales', data=rossmann_df, ax=axis1) sns.barplot(x='Year', y='Customers', data=rossmann_df, ax=axis2) # Drop Date column # rossmann_df.drop(['Date'], axis=1,inplace=...
No
5
75
Visualization
time_series
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,745
# Customers fig, (axis1,axis2) = plt.subplots(2,1,figsize=(15,8)) # Plot max, min values, & 2nd, 3rd quartile sns.boxplot([rossmann_df["Customers"]], whis=np.inf, ax=axis1) # group by date and get average customers, and precent change average_customers = rossmann_df.groupby('Date')["Customers"].mean() # pct_cha...
No
3
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,746
# DayOfWeek # In both cases where the store is closed and opened fig, (axis1,axis2) = plt.subplots(1,2,figsize=(15,4)) sns.barplot(x='DayOfWeek', y='Sales', data=rossmann_df, order=[1,2,3,4,5,6,7], ax=axis1) sns.barplot(x='DayOfWeek', y='Customers', data=rossmann_df, order=[1,2,3,4,5,6,7], ax=axis2)
No
5
75
Visualization
time_series
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,747
# Promo # Plot average sales & customers with/without promo fig, (axis1,axis2) = plt.subplots(1,2,figsize=(15,4)) sns.barplot(x='Promo', y='Sales', data=rossmann_df, ax=axis1) sns.barplot(x='Promo', y='Customers', data=rossmann_df, ax=axis2)
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null