i have a dataset with two columns user posts (posts) and personality type (type) , i need personality type according to posts using this dataset so i used random forest regression for prediction here is my code:-
df = pd.read_csv('personality_types.csv') count_vectorizer = CountVectorizer(decode_error='ignore') X = count_vectorizer.fit_transform(df['posts']) y = df['type'].values Xtrain, Xtest, Ytrain, Ytest = train_test_split(X, y, test_size=0.33) random_forest = RandomForestClassifier(n_estimators=100) random_forest.fit(Xtrain, Ytrain) Y_prediction = random_forest.predict(Xtest)
random_forest.score(Xtrain, Ytrain) acc_random_forest = round(random_forest.score(Xtrain, Ytrain) * 100, 2) print(round(acc_random_forest,2,), "%") 100%
now i want to get prediction from a custom text how can i achive that ? how can i get personality type of a post separately using this model.