Here is the sample data I have:
Tag 1(Val: X), Tag 2(Val: Y), Tag 3(Val: Z), Label (Val: P)
Tag 1(Val: A), Tag 2(Val: B), Tag 3(Val: C), Label (Val: Q)
Tag 1(Val: D), Tag 2(Val: E), Tag 3(Val: F), Label (Val: R)
Tag 1(Val: G), Tag 2(Val: H), Tag 3(Val: I), Label (Val: S)
I started by putting the Tags into a dataframe df and the Label into a separate dataframe df_label. Then used a HashingVectorizer to prepare the text for processing by ML models (I want to hash the strings into a unique numerical value so that the ML Models can train on it)
vectorizer = HashingVectorizer() X_train = vectorizer.transform(df) y_train = vectorizer.transform(df_label) clf = RandomForestClassifier(n_jobs=2, random_state=0) clf.fit(X_train, y_train)
When I execute this, I get:
ValueError: Unknown label type: 'unknown' on y_train.
I am new to both Python and ML and I am not sure whether the problem is with my basic logic or whether it is a trivial implementation issue. Appreciate your insight and support.