Ask Your Question
0

Save Class Names as String in Learned Model

asked 2019-05-22 18:46:31 -0600

Masroor gravatar image

Hi,

I was wondering how to use Random Forest to take in the Classes Names (string values) and to save these string names in the learned model file.

Also, the model file store Field Index/ID, is it possible to also same the names of the fields/attributes used for training in the learned model file.

Many thanks,

Hussain

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-05-23 02:15:12 -0600

berak gravatar image

updated 2019-05-23 02:17:31 -0600

sad as it is, none of what you wanted is builtin. all strings are discarded while reading the csv, and replaced with (1 based !) indices, in the order of the appearance.

maybe you should do your own csv preprocessing, to handle this better, instead of opencv's TrainData utility.

categorial values, which do not represent an order (e.g: "cat","autobus","accordeon") should NOT be represented in a single numeric variable (like it is done here, (0,1,2)), but you have to find a suitable embedding for your string set, like "one-hot" encoding them.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-05-22 18:46:31 -0600

Seen: 64 times

Last updated: May 23 '19