Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Never commit real secrets

# Groq API key used by chatbot features
GROQ_API_KEY=your_groq_api_key_here
GROQ_API_KEY=""

# Optional: override dataset path for local runs
# NEXALEARN_DATASET_PATH=broken-ai_deadcode_dataset.csv
12 changes: 8 additions & 4 deletions ml_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
# SECTION 1 │ LOAD DATASET FROM CSV
# ═════════════════════════════════════════════════════════════════════════════

DATASET_PATH = os.getenv("NEXALEARN_DATASET_PATH", "broken-ai_deadcode_dataset.csv")
# DATASET_PATH = os.getenv("NEXALEARN_DATASET_PATH", "broken-ai_deadcode_dataset.csv")
DATASET_PATH = "data/broken-ai_deadcode_dataset.csv"


def _prepare_dataset_from_csv(path: str) -> pd.DataFrame:
Expand Down Expand Up @@ -190,7 +191,9 @@ def _prepare_dataset_from_csv(path: str) -> pd.DataFrame:

for col in numeric_cols:
if col in df.columns:
df[col] = pd.to_numeric(df[col], errors="ignore")
df[col] = pd.to_numeric(df[col], errors="coerce")
df.replace(["MISSING", "missing", "unknown", "#REF!"], np.nan, inplace=True)
# df[col] = pd.to_numeric(df[col], errors="ignore")

# Replace ±inf with 0 so they slip past null checks
df.replace([np.inf, -np.inf], 0, inplace=True)
Expand Down Expand Up @@ -247,7 +250,8 @@ def _prepare_dataset_from_csv(path: str) -> pd.DataFrame:

# Drop rows with excessive nulls
threshold = 0.5
rows_to_drop = df[df.isnull().mean() > threshold].index
rows_to_drop = df[df.isnull().mean(axis=1) > threshold].index
# rows_to_drop = df[df.isnull().mean() > threshold].index
df = df.drop(index=rows_to_drop)

df_clean = df.copy()
Expand Down Expand Up @@ -426,7 +430,7 @@ def _prepare_dataset_from_csv(path: str) -> pd.DataFrame:
for name, model in models.items():
scores = cross_val_score(
model,
X_scalled,
X_scaled,
y,
scoring="accuracy",
cv=kf,
Expand Down
Binary file added plots/eda_categorical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/eda_histograms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.