- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2025 07:06 AM
Problem I am solving:
Reads the raw sports data IPL CSV → bronze layer
Cleans and aggregates → silver layer
Summarizes team stats → gold layer
Prepares ML-ready features and trains a Random Forest classifier to predict match winners
Getting error: [PARSE_SYNTAX_ERROR] Syntax error at or near end of input. SQLSTATE: 42601 when i run code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2025 12:19 PM - edited 08-28-2025 12:20 PM
Hi @ManojkMohan ,
This section here:
df_ml
.select("features", "label")
.limit(10000) # Optional: limit for performance
.collect()I don't see anywhere prior to this code block where you actually created "df_ml"? Has that dataframe even been created prior to this? If yes, are you certain both of those columns ["features", "label"] are present in that dataframe.
All the best,
BS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2025 08:07 AM
@BS_THE_ANALYST any framework recommendations for which ML to chose based on data , the way i have solved the problem for now
Data is ingested and converted to a usable format.
- Features and labels define the ML problem.
- Validation ensures data integrity.
- Train/test split prepares for robust evaluation.
- Random Forest learns patterns in IPL team stats.
- Predictions and metrics evaluate model quality.
- Output reporting allows easy interpretation and decision support.
Building Block: Data Source → Pandas DataFrame
Value Added:
- Reads historical IPL data from a “gold” table in Spark.
- Converts it to Pandas for use with scikit-learn.
- Provides the raw material (features + labels) needed for ML.
Building Block: Feature Engineering
Value Added:
- Selects numeric attributes (TotalRunsScored, MatchesPlayed, MaxMarginWon) as predictors.
- Assigns the match winner (team1) as the target variable.
- Ensures ML model knows what to learn from and what to predict.
Building Block: Data Quality Checks
Value Added:
- Ensures all required features exist.
- Warns if a team occurs only once (prevents issues with small data).
- Improves robustness and interpretability
Building Block: Model Validation Setup
Value Added:
- Splits data into training (to learn patterns) and testing (to evaluate performance).
- Supports generalization, ensuring the model is not overfitting.
- Stratification maintains class proportions where possible.
Building Block: ML Model
Value Added:
- Random Forest is an ensemble method that captures nonlinear relationships.
- Learns the mapping between numeric match stats and match winner.
- Model training creates the predictive engine.
Building Block: Model Evaluation
Value Added:
- Measures accuracy (how many winners were predicted correctly).
- Confusion matrix shows true vs predicted class counts, giving insight into model behavior.
- Ensures model performance is quantified before deployment.
Output: Prediction Comparison
Building Block: Results Visualization / Reporting
Value Added:
- Provides a side-by-side view of predictions vs actual winners.
- Helps stakeholders understand model outputs.
- Makes model results actionable for further analysis or decision-making.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2025 08:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2025 09:53 AM
@ManojkMohan thanks for sharing this, I'm looking at starting an ML project in the coming weeks, I might have to bring this forward 😂. Feeling motivated with that confusion matrix in your output 👍.
Congrats on getting it working!
All the best,
BS