5.5 AI: Train Your Model
It is time to move from planning your AI dataset to actually using it. Today, we’re focusing on the exciting step of Training Your AI Model! This is where you take the data you’ve carefully planned and gathered, and use an online tool to teach the computer how to recognize the patterns within it.
Lesson Topic: 5.5 AI: Train Your Model

Part 1: Recap – Fueling Your AI (Your Dataset)
Before we start training, let’s quickly remember what makes a good dataset (the fuel for your AI):
- Right Data Type: Images, Sound, Text, or Numbers relevant to your project.
- Quantity: Lots of examples (aim for 50+ per class/category).
- Balance: Roughly equal numbers of examples for each class.
- Diversity: Varied examples within each class to avoid bias.
- Separate Test Set: 10-20% of your data kept aside, only for testing the trained model later.
And remember you could gather data from your Community, use Public Datasets, or collect it via Sensors.

Part 2: Choosing Your Training Ground (The Platform)
Now, you need to choose an online Platform (a website or tool) where you will upload your data and train your AI model. How do you choose? Consider these two main factors:
- Data Type Support: Does the platform work with the type of data you collected (Images, Sound, Text, Numbers, Poses)?
- App Integration: Can you easily use the trained model in your chosen app development tool (App Inventor or Thunkable)?
Here’s a quick look at the user-friendly platforms suggested in the lesson, focusing on how they fit with your likely tools:
- Teachable Machine (by Google):
- Good for: Images, Sounds, Poses.
- Integrates with: App Inventor (often requires an extension), Python, or other web projects.
- Feel: Very visual and easy-to-use web interface. Great for starting.
- Check the tutorials linked in the lesson!
- Machine Learning for Kids (ML4K):
- Good for: Images, Sounds, Text, Numbers. (Wider data type support).
- Integrates with: App Inventor, Python, Scratch.
- Feel: Designed for education, good examples. Requires a teacher/mentor to create an account for the team.
- Check the Technovation project examples linked!
- MIT App Inventor (AI Extensions):
- Good for: Images, Sounds, Poses (using specific extensions you add to App Inventor).
- Integrates with: App Inventor (directly within the tool).
- Feel: Convenient if you’re already comfortable coding in App Inventor. Might involve slightly more setup with extensions.
- Check the App Inventor AI tutorials linked!
- Ximilar:
- Good for: Images.
- Integrates with: Thunkable (often via something called an API), Web Apps.
- Feel: More business-focused, but a good option if Thunkable is your platform for image classification.
- Check the tutorial linked (focus on the training part first)!
Recommendation: Look at the tutorials for the 1-2 platforms that best match your data type AND your coding tool (App Inventor/Thunkable). See which one feels easiest for your team to use.
(Note: There are more advanced platforms like TensorFlow, PyTorch, etc., but they usually require strong Python coding skills and are likely beyond the scope for most starting teams.)
Part 3: The Training Workout (The General Process)
Most of these user-friendly platforms follow a similar training process:
- Start Project: Create a new project or model on the platform’s website.
- Define Classes: Create and name your categories (e.g., “Helmet”, “No Helmet”; “Ripe”, “Unripe”).
- Upload Training Data: This is key! Add your collected data (images, sound files, etc.) to the correct class.
- It’s okay if your dataset isn’t 100% complete yet! Start training with the data you have now. You can usually add more data and retrain later.
- Click “Train Model”: Find the button to start the training. The platform will analyze the data and build the model. This might take a few minutes depending on the platform and data size. Be patient!
- Test (Quick Check): Most platforms offer an immediate ‘Preview’ or ‘Test’ area. Use your webcam, microphone, or upload a file to give the model new input and see its prediction instantly. This gives you a quick feel for whether it’s working.
- SAVE YOUR MODEL: Extremely important! Find the option to save your trained model project on the platform, or export the model file if needed for integration later. You don’t want to lose your training work!
Part 4: Is the AI Learning? (Testing & Improving – The Loop!)
The initial training is just the first step. You need to check how well the AI learned and improve it if necessary. This is an iterative process (a loop):
- Test Formally: Use the Test Data you kept separate (the examples the AI hasn’t seen). Feed each test example to your trained model and record whether the prediction is correct or incorrect.
- Evaluate Accuracy: Calculate the percentage of test examples your model got right. (e.g., Correct predictions / Total test examples * 100).
- Is Accuracy Good Enough? The lesson suggests that if accuracy is low (e.g., below 70-80%), you likely need to improve the model.
- What’s “Good Enough”? As the guiding questions suggest, this depends! An app identifying types of local fruit might be okay at 80% accuracy. An app trying to detect signs of a serious plant disease might need to be much more accurate (maybe 95%+) because the cost of a wrong prediction is higher. Discuss this as a team.
- Improve (If Needed): Low accuracy usually means the training data needs improvement.
- Add More Diverse Training Data: Go back and collect more varied examples for the classes the model struggles with. Did you have enough different angles, lighting conditions, backgrounds, examples from different sources? Add these to your training set.
- Retrain: Upload the new data and train the model again.
- Retest: Test again using the same test set you used before. Did the accuracy improve?
- Repeat: Keep repeating the cycle (add/improve data -> retrain -> retest) until you reach an accuracy level you’re satisfied with for your project.
Mentor Tip: Training AI isn’t always perfect on the first try! Even big companies sometimes get unexpected results. Be persistent, focus on improving your dataset, and don’t get discouraged!
Part 5: Let’s Train! (Activity)
Time to get hands-on with your AI model!
Your Mission: Choose your platform and perform the first training cycle for your project’s AI.
Task:
- Choose Platform: Based on your data type and App Inventor/Thunkable choice, select the platform you’ll use (Teachable Machine, ML4K, AI Extensions, Ximilar?).
- Access Platform: Go to the website, sign up/log in as required (remember ML4K needs mentor setup).
- Define Classes & Upload Data: Create your project, define your classes/labels, and upload the training data you have gathered so far.
- Train: Click the “Train Model” button.
- Save: Make sure you save the model project on the platform or export the model file.
- Quick Test: Use the platform’s built-in preview/test function. Does it seem to work roughly?
- Formal Test (If Ready): If you have your test set ready, test the model with those unseen examples and note down the accuracy.
- Plan Next Steps: Based on the testing, decide if you need to gather more/better training data before your next training attempt.
Part 6: Quick Review (Key Terms)
- Platform: The online tool/website used to train the AI model (e.g., Teachable Machine).
- Classification: The task of teaching AI to categorize input into predefined classes/labels.
- Training: The process where the AI platform learns patterns from your dataset.
- Testing: Evaluating the trained model’s performance using unseen data (the test set).
- Accuracy: The percentage of test examples the model classifies correctly.
- Iteration: The cycle of training, testing, evaluating, and improving the data/model.
Part 7: Advanced Options & Resources
Remember, while we focus on user-friendly platforms, more advanced tools exist if your coding skills grow (mentioned in Additional Resources).
Conclusion
You’re now stepping into the role of an AI trainer! This is where your carefully planned dataset comes alive. Remember that training is often a cycle – train, test, improve the data, retrain, test again. Don’t expect perfection on the first try. Start with the data you have, save your work, and focus on iterating towards a model that works well for your specific Ugandan context. Mbasabira bulungi! (I wish you well!)