DEV Community

Discussion on: Code-free machine learning with Ludwig

Collapse
 
timusletap profile image
TimusLetap

Can you please elaborate setting up the definition of yaml for model definition??

Collapse
 
chrishunt profile image
Chris Hunt • Edited

Hi - yeah sure. The modeldef file is a YAML file which defines, at its most basic, the input and output features. In this most basic of examples, we're telling Ludwig that the input features are either numerical or category. This then preprocessed the data to train our model.

More complex models may use a level of NLP to break down sentences or process images. This would all be specified in the input feature.

Equally, we may want to define how the output features are generated. Again, that's specified here.

In my final refinement above, I've also specified the training parameters.

Documentation and plenty of examples can be found here - uber.github.io/ludwig/examples/

The final, full modeldef.yaml from the above example looks like gist.github.com/c-m-hunt/3271efb2a...

Collapse
 
timusletap profile image
TimusLetap

So for a scenario specific question I'm running ludwig in colab and the format of the yaml file as described in the docs doesn't work the same way rendering errors. Have you had an opportunity to explore this?

Thread Thread
 
chrishunt profile image
Chris Hunt

Took a bit of fiddling to get running in Colab but here it is...
colab.research.google.com/drive/1Z...

I think the explanation at the top of the notebook may have been the issue you were having. I had been running from terminal so hadn't come across it. See Github issue for details.

The first bit is getting the data and just dropping NaNs. Also changed one column name as I couldn't work out how to get it working with column names with spaces in.

The rest is the training. The key is that the training is code free.

Thread Thread
 
timusletap profile image
TimusLetap

In both instances however you use a pre-built model_definition.yaml file. Any chance you would now how to create a simple model_definition.yaml file from scratch in-line? I kind of wanted to understand how that would work as it is not described in the documents so well.

Thread Thread
 
chrishunt profile image
Chris Hunt

It's not "pre-built" - you have to write the model definition yourself.

The docs at uber.github.io/ludwig/user_guide/#... explain the basics of the model definition file. It's just a yaml file defining the input and output features along with any additional parameters you want to override the Ludwig defaults.

Thread Thread
 
timusletap profile image
TimusLetap

Thank you. I figured it out. I just didn't realize how to start it off.