-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method to retrieve predictions from SSC #4
Comments
Thanks for your interest! |
My question is more related to having a function to obtain that information in table format. Using predict doesn't provide that info. You suggest to use predict on my unlabeled data, but, which model should I use for that prediction? `######################REDUCED CODE###################### m <- selfTraining(x = xtrain, y = ytrain, learner = knn3, learner.pars = list(k = 1)) pred <- predict(m, xitest, interval="confidence") summary(pred) ` Once I carry out this prediction, how do I get the data I'm really looking for, because this way I end up with a summary of the predictions, but no clue about which label corresponds to each row. Do you see what I mean? |
I think I understand what you are looking for. Could you please try this code? But if it is not solving your problem, please continue asking! ##Load Iris data set x <- iris[, -5] # instances without classes ##Prepare data, use 50% of instances for training ##Use 70% of train instances as unlabeled set ##train selftraining with base classifiers knn3 ##transductive test ##creating a matrix with the training data unlabeled + predicted labels by selftraining-knn3 |
Dear @mabelc, Thank you very much for your piece of code. It works, and was exactly what I was asking for. Just one more question, I have read the selfTraining function documentation and cannot figure out how to change the learner parameter from KNN3 to random forest, svm or any other classifier. Is there a list of the available classifiers explained somewhere? Thanks in advance for your kind help. |
Hi, In this paper https://cran.r-project.org/web/packages/ssc/vignettes/ssc.pdf you can find many examples with different learners. I have modified the previous example to use SVM as learner. Basically you can use learners from R ecosystem, the generic functions provided will help you with that. In the example I am using the generic version of selfTraining, named selfTrainingG. library('ssc') ##Load Iris data set x <- iris[, -5] # instances without classes ##Prepare data, use 50% of instances for training ##Use 70% of train instances as unlabeled set ##wrapper functions to train a SVM gen.pred <- function(model, indexes){ ##train generic selftraining with SVM as base classifier ##transductive test ##creating a matrix with the training data unlabeled + predicted labels by selftraining-knn3 |
Dear developers,
I was looking for a Semi-Supervised ML method in R and found your excellent package. I tried your example code adapting it to my input data, and after some reformating it works apparently well. The problem I have is related to how to access prediction results for each of the rows in my input table.
I may sound naive, but I can't find the code to access the classification assigned for each of the "unlabeled" rows in my table, by any of the methods carried out in your vignette's example code.
I can access the sumary of how many samples have been assigned to each class, but I'd like to know how to access to each row's individual class/label prediction (in dataframe format, for instance).
I hope I was able to explain myself clearly enough for everybody to understand this request.
Thanks in advance and congrats for your nice work.
The text was updated successfully, but these errors were encountered: