Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Gurneet1928/TryMLEasy/llms.txt

Use this file to discover all available pages before exploring further.

TryMLEasy’s neural network path spans three dedicated pages that walk you from layer design all the way through to training metrics and loss curves — no Python required. The workflow is linear: first you configure your layers using an interactive table, then you verify the compiled architecture by reviewing the model summary, and finally you train the network with your chosen epochs and batch size. Each page stores its outputs in Streamlit session state so the model carries forward automatically.

Step 1 — Configure Layers

Page: pages/7_neural_network_configuration.py The configuration page presents a dynamic st.data_editor table where each row represents one Dense layer in your network. You build the architecture by adding rows and filling in three columns for each layer:
ColumnTypeConstraintsDescription
Layer NameTextRequiredA descriptive label for the layer (e.g., "Input Layer", "Hidden Layer")
NeuronsNumber2 – 100, requiredThe number of units in this Dense layer
Activation FunctionSelectboxrelu, sigmoid, tanhThe activation applied after the linear transformation
The table starts empty. Click the + icon at the bottom of the editor to add rows one at a time, filling in the details for each layer from input to the last hidden layer before the output. A representative layer configuration might look like this:
| Index | Layer Name   | Neurons | Activation Function |
|-------|--------------|---------|---------------------|
| 0     | Input Layer  | 64      | relu                |
| 1     | Hidden Layer | 32      | relu                |
| 2     | Output Prep  | 16      | sigmoid             |
Once you are satisfied with your layer stack, click Verify Architecture to save the configuration into st.session_state.nn_config and proceed to the architecture verification page.
You must manually enter the index value (0, 1, 2, …) for each row you add to the table. Rows without a valid index are not accepted by the editor and will be silently dropped when the configuration is saved. This is a known limitation of the current version — the TryMLEasy team is actively working on improving the layer editor UX.

Step 2 — Verify Architecture

Page: pages/8_neural_network_architecture.py On this page, TryMLEasy takes the layer table from session state, constructs a tf.keras.Sequential model, and prints its full summary so you can confirm everything looks correct before training begins. The model is built with two automatic additions that you do not need to configure manually:
  1. Input layer — a tf.keras.layers.Input layer is prepended with shape=(num_features,), where num_features is the number of feature columns you selected on the Feature Selection page.
  2. Output layer — a single Dense(1) layer (no activation) is appended after your user-defined layers to produce a scalar prediction.
The compilation settings are fixed: Adam optimizer with MSE loss, tracking mse as a metric. Here is the exact construction logic used internally:
import tensorflow as tf

model = tf.keras.Sequential()

# Automatically prepended from selected feature count
model.add(tf.keras.layers.Input(shape=(num_features,)))

# Your user-defined layers (example)
model.add(tf.keras.layers.Dense(64, activation='relu'))
model.add(tf.keras.layers.Dense(32, activation='relu'))
model.add(tf.keras.layers.Dense(16, activation='sigmoid'))

# Automatically appended output layer
model.add(tf.keras.layers.Dense(1))

model.compile(optimizer='adam', loss='mse', metrics=['mse'])
model.summary(print_fn=lambda x: st.text(x))
The model.summary() output is streamed directly to the page via st.text(), giving you a layer-by-layer view of parameter counts and output shapes. Review it carefully — if the architecture looks wrong (wrong number of layers, mismatched shapes), click Back (Neural Network Configuration) to edit the layer table and rebuild. When the architecture looks correct, click Train Model to store the compiled model in st.session_state.keras_model and move to the training page.

Step 3 — Train the Network

Page: pages/9_train_neural_network.py The training page is where you set the final hyperparameters and start the fitting process. Two st.number_input fields let you specify:
  • Epochs — the number of full passes over the training data. The Train Neural Network button is disabled until both this and batch size are non-zero.
  • Batch Size — how many samples are processed per gradient update.
Click Train Neural Network to begin. TryMLEasy uses a custom Keras callback to print live progress for each epoch directly on the page in the format:
Epoch ---- Loss ---- Val_Loss
0 ----- 0.43 ----- 0.51
1 ----- 0.38 ----- 0.46
2 ----- 0.34 ----- 0.42
...
After all epochs complete, the model is evaluated on the test set one final time and the result is shown:
Final Loss on Test Data : 0.31
A Training vs. Validation Loss graph is then rendered using matplotlib, plotting history.history['loss'] and history.history['val_loss'] against epoch number. This chart is the primary tool for diagnosing underfitting (both curves still decreasing) and overfitting (validation loss rising while training loss falls).
loss_res = plt.figure(figsize=(13, 5))
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('Training vs Validation Loss')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['train_loss', 'val_loss'], loc='upper right')
st.pyplot(loss_res)

Tips for Good Results

For most tabular datasets, starting with 32–64 neurons in the first hidden layer and gradually reducing towards the output (e.g., 64 → 32 → 16) works well. This funnel shape encourages the network to learn increasingly abstract representations. Very small datasets may not need more than 16–32 neurons per layer — too many parameters relative to training samples leads to overfitting.
ReLU (relu) is the safest default for hidden layers — it is computationally cheap, avoids the vanishing gradient problem, and works well across a wide range of tasks. Use Sigmoid (sigmoid) in the last hidden layer if you want outputs bounded between 0 and 1, or when working on binary-like regression targets. Tanh (tanh) is a reasonable alternative to sigmoid that centres outputs around zero, which can help with convergence in deeper networks.
Watch the Training vs. Validation Loss graph after your first run. If both curves are still declining at the end, increase your epoch count. If the validation loss starts rising while training loss keeps falling, you are overfitting — stop training earlier (reduce epochs) or simplify your architecture (fewer neurons or layers). A good starting range is 50–200 epochs for small-to-medium tabular datasets.
A flat or erratic loss curve usually points to one of these causes:
  • Features are not scaled. Neural networks are sensitive to feature scale. Go back to the Feature Selection page and choose Standard Scaler or MinMax Scaler in the preprocessing step — note that while the traditional model pipeline applies the scaler automatically, for neural networks you should ensure your data is scaled before uploading, or select a scaler and manually apply it to your dataset outside TryMLEasy.
  • Too few neurons. If the network cannot express the underlying relationship, loss will stagnate. Try doubling the neuron count in each layer.
  • Wrong activation function. Try switching to relu for hidden layers if you are using sigmoid or tanh throughout.
  • Learning rate or batch size mismatch. TryMLEasy uses the Adam optimizer’s default learning rate. Very large batch sizes can slow convergence — try a batch size between 16 and 64.

Build docs developers (and LLMs) love