Skip to content
Snippets Groups Projects
Commit 2922a4d8 authored by Marder's avatar Marder
Browse files

matching

parent 031c3a97
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,7 @@ data <- data %>%
# Split the data into labeled and unlabeled sets
labeled_data <- filter(data, Choice_Treat==1| Choice_Treat==0)
unlabeled_data <- filter(data, is.na(Choice_Treat))
labeled_data_id<-labeled_data
labeled_data<-select(labeled_data,-id)
# Assuming the group information is in the column called 'Group'
labeled_data$Choice_Treat<- as.factor(labeled_data$Choice_Treat)
......@@ -140,6 +141,10 @@ labeled_data$PredictedGroup <- labeled_predictions
table(labeled_data$Choice_Treat, labeled_data$PredictedGroup)
unlabeled_predictions <- predict(model3, newdata = unlabeled_data)
labeled_data_id$PredictedGroup <- labeled_predictions
data_prediction_labeled<-select(labeled_data_id, c("id", "PredictedGroup"))
saveRDS(data_prediction_labeled, "Data/predictions_labeled.RDS")
unlabeled_data$PredictedGroup <- unlabeled_predictions
data_prediction<-select(unlabeled_data, c("id", "PredictedGroup"))
saveRDS(data_prediction, "Data/predictions.RDS")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment