简体   繁体   English

在新的未标记的单一观察或数据集上使用经过测试的机器学习模型?

[英]Use tested machine learning model on new unlabeled single observation or dataset?

How can I use a trained and tested algorithm (eg. machine learning classifier) after being saved, on a new observation/dataset, whose I do not know the class (eg. ill vs healthy) based on predictors used for model training?基于用于模型训练的预测变量,我如何在新的观察/数据集上保存经过训练和测试的算法(例如机器学习分类器),我不知道该类(例如生病与健康)的类别? I use caret but can't find any lines of code for this.我使用插入符号,但找不到任何代码行。 many thanks非常感谢

After training and testing any machine learning model you can save the model as .rds file and call it as在训练和测试任何机器学习模型后,您可以将模型保存为.rds文件并将其命名为

#Save the fitted model as .rds file
saveRDS(model_fit, "model.rds")
my_model <- readRDS("model.rds")

Creating a new observation from the same dataset or you can use a new dataset also从相同的数据集创建新的观察,或者您也可以使用新的数据集

new_obs <- iris[100,] #I am using default iris dataset, 100 no sample

Prediction on the new observation对新观测的预测

predicted_new <- predict(my_model, new_obs)
confusionMatrix(reference = new_obs$Species, data = predicted_new)
table(new_obs$Species, predicted_new)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用机器学习模型来处理新数据? - How to use machine learning model to new data? 如何在Android上的Weka中使用机器学习模型来预测新值? - How to use a machine learning model with Weka on Android to predict new values? 在不同的数据集上运行经过培训的机器学习模型 - Run trained Machine Learning model on a different dataset Swift机器学习观察无法正常工作 - Swift Machine Learning Observation Not working 如何使用机器学习(Tensorflow)使用新的数据集构建图像处理模型? - How to build an image processing model with new dataset using machine learning (Tensorflow)? 如何将现有机器学习模型与 Azure 机器学习结合使用? - How to use an existing machine learning model with Azure Machine Learning? 使用新数据重新训练现有机器学习模型 - Retraining an existing machine learning model with new data 如何将 Label 数据多个 csv 文件作为 python 中的单个观察进行机器学习 - How to Label data multiple csv files as single observation in python for machine learning 机器学习数据集关联 - Machine learning dataset correlation 机器学习算法仅对阳性和未标记数据进行分类 - Machine learning algorithm to classify only positive and unlabeled data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM