Changing the neural network architecture
Thehidden argument to neuralnet() controls the number and size of hidden layers.
- Fewer neurons / shallower networks overfit less and train faster. Start here with small datasets.
- More neurons / deeper networks can capture more complex patterns but require more data and are more prone to overfitting.
- For a dataset the size of
sumo.csv(~130 rows, 8 features),hidden = c(4, 2)orhidden = 8are reasonable starting points.
Adjusting the train/test ratio
data.split() takes a ratio between 0 and 1 controlling what fraction of rows go to training:
Adding or removing features
The formularesult ~ . means “predict result using all other columns in the data frame.” This means you can add or remove features by simply adding or removing columns from your CSV — no formula changes needed.
result ~ . with an explicit formula:
All columns in the CSV are coerced to numeric by
sumo.read(). Features with many unique values (like IDs or names) will produce meaningless numeric encodings. Either drop those columns or encode them manually before including them.Changing the activation function
Theact.fct argument in neuralnet() accepts either a string name or a custom function:
(0, 1). The >= 0.5 threshold used in prediction corresponds directly to the midpoint of the sigmoid range.
Adapting to other binary classification sports problems
Sumo Oracle’s structure is not sumo-specific. Any sport where you want to predict a binary outcome (team A wins vs team B wins) can use the same workflow:Define your features
Identify numeric statistics that describe each competitor: historical win rate, physical attributes, recent form, head-to-head record, etc. Add one column per statistic, with
1 and 2 suffixes to distinguish the two sides.Build your CSV
Use the same format: one row per historical match, numeric columns,
result as 1 (left/home wins) or 0 (right/away wins), blank result for future matches.Reuse sumo.read() and data.split() unchanged
These functions are data-agnostic. They work on any CSV matching the expected format.
How the R formula interface works
R formulas use the syntaxresponse ~ predictors. In result ~ .:
resultis the response variable (what you are predicting)..is shorthand for “all other columns in the data frame.”
| Formula | Meaning |
|---|---|
result ~ . | All columns except result |
result ~ weight1 + weight2 | Only weight1 and weight2 |
result ~ . - height1 - height2 | All columns except result, height1, and height2 |
result ~ weight1 * weight2 | weight1, weight2, and their interaction term |
glm() and neuralnet() accept the same formula syntax, so you can use identical formulas for both models.