DEV Community 👩‍💻👨‍💻

Cover image for Build your ML models automatically using GitHub actions
haimantika mitra
haimantika mitra

Posted on

Build your ML models automatically using GitHub actions

Machine Learning Model training made easy! I have made a GitHub action using the package autofeat, that automates our classification model.
This action is an entry to the GitHub actions hackathon submission, under the DIY Deployment category.

What does the GitHub action do? 📢

It automates your Machine Learning model training, with the help of autofeat python package. This GitHub action makes use of AutoFeatClassifier() to build to the classification model.

Disclaimer: For models with very low samples, they might overfit on noise in the dataset, i.e., find some new features that lead to a good prediction on the training set but result in poor performance on new test samples.

How to use? 💁

You will find my "Automated ML Models using Autofeat package" action in the marketplace.
Then follow these simple steps:

  • Click on Use latest version, a prompt will be displayed. We need to copy the code and use it in our workflow as shown below. Alt Text
  • Make your workflow as shown below. (I have used the Iris dataset as an example)
name: Iris Dataset Classifier
on: [push]
    runs-on: ubuntu-latest
    - name: Train the model
      id: model
      uses: Haimantika/random@master
        myInput: "[5.1,3.5,1.4,2.1,1.8,0.2]"
    - name: Upload artifact
      uses: actions/upload-artifact@v2
        name: my-artifact
        path: model.pkl
Enter fullscreen mode Exit fullscreen mode
  • Create a repository and upload the dataset to train the model. The name of the dataset file must be dataset.csv
  • Go to Actions on GitHub Console and click on Set up a workflow yourself. Alt Text
  • Click on Start commit, give a commit message (optional) and click on Commit new file. The workflow begins soon after this.
  • Click on the workflow and you’ll get the console output. You can click on Artifacts and download the model file keep it for later use.

Find the entire code here.

Working demo:

P.S- This is my first ever GitHub action! Let me know your views on it! ✌️

Top comments (1)

phase_seven profile image
Ratul Roy

Very cool, loved it!

👋 New to DEV?

Head over to our Welcome Thread and tell us what you're working on!