prediction

How to use save model for prediction in python

我的未来我决定 提交于 2019-12-03 22:21:42
问题 I am doing a text classification in python and I want to use it in production environment for making prediction on new document. I am using TfidfVectorizer to build bagofWord. I am doing: X_train = vectorizer.fit_transform(clean_documents_for_train, classLabel).toarray() Then I am doing cross validation and building the model using SVM. After that I am saving the model. For making prediction on my test data I am loading that model in another script where I have the same TfidfVectorizer and I

How to predict survival probabilities in R?

旧城冷巷雨未停 提交于 2019-12-03 21:32:04
问题 I have data called veteran stored in R. I created a survival model and now wish to predict survival probability predictions. For example, what is the probability that a patient with 80 karno value, 10 diagtime , age 65 and prior=10 and trt = 2 lives longer than 100 days? In this case the design matrix is x = (1,0,1,0,80,10,65,10,2) Here is my code: library(survival) attach(veteran) weibull <- survreg(Surv(time,status)~celltype + karno+diagtime+age+prior+trt ,dist="w") and here is the output:

How to save glm result without data or only with coeffients for prediction?

一个人想着一个人 提交于 2019-12-03 17:47:33
问题 When I use the following R code, model_glm=glm(V1~. , data=xx,family="binomial"); save(file="modelfile",model_glm); The size of modelfile will be as much as the data, which will be 1gig in my case. How can I remove the data part in the result of model_glm, so I can only save a small file. 回答1: Setting model = FALSE in your call to glm should prevent the model.frame from being returned. Also setting y = FALSE will prevent the response vector from being returned. x = FALSE is the default

Get prediction percentage in WEKA using own Java code and a model

大憨熊 提交于 2019-12-03 16:23:59
Overview I know that one can get the percentages of each prediction in a trained WEKA model through the GUI and command line options as conveniently explained and demonstrated in the documentation article " Making predictions " . Predictions I know that there are three ways documented to get these predictions: command line GUI Java code/using the WEKA API, which I was able to do in the answer to " Get risk predictions in WEKA using own Java code " this fourth one requires a generated WEKA .MODEL file I have a trained .MODEL file and now I want to classify new instances using this together with

How do I adapt my recommendation engine to cold starts?

≯℡__Kan透↙ 提交于 2019-12-03 15:12:42
I am curious what are the methods / approaches to overcome the "cold start" problem where when a new user or an item enters the system, due to lack of info about this new entity, making recommendation is a problem. I can think of doing some prediction based recommendation (like gender, nationality and so on). Maybe there are times you just shouldn't make a recommendation? "Insufficient data" should qualify as one of those times. I just don't see how prediction recommendations based on "gender, nationality and so on" will amount to more than stereotyping. IIRC, places such as Amazon built up

How to use weka for predict results

ⅰ亾dé卋堺 提交于 2019-12-03 12:17:42
问题 Im new to weka and I'm confused with the tool. What I needed to do is im having a data set about fruit price and relating attributes and im trying to predict the specific fruit price using the data set. Since I'm new to weka I couldn't figure out how to do this task. Please help me or guide me to a tutorial about how to do predictions and what is the best method or the algorithm to do this task. Thank You. 回答1: If you want to know more about how to save a trained classifier and load the same

difference between speculation and prediction

你离开我真会死。 提交于 2019-12-03 09:51:25
问题 In computer architecture, what is difference between (branch) prediction and speculation?? These seems very similar, but i think there is a subtle distinction between them. 回答1: Branch prediction is done by the processor to try to determine where the execution will continue after a conditional jump, so that it can read the next instruction(s) from memory. Speculative execution goes one step further and determines what the result would be from executing the next instruction(s). If the branch

Explain onehotencoder using python

做~自己de王妃 提交于 2019-12-03 09:45:10
问题 I am new to scikit-learn library and have been trying to play with it for prediction of stock prices. I was going through its documentation and got stuck at the part where they explain OneHotEncoder() . Here is the code that they have used : >>> from sklearn.preprocessing import OneHotEncoder >>> enc = OneHotEncoder() >>> enc.fit([[0, 0, 3], [1, 1, 0], [0, 2, 1], [1, 0, 2]]) OneHotEncoder(categorical_features='all', dtype=<... 'numpy.float64'>, handle_unknown='error', n_values='auto', sparse

Caffe net.predict() outputs random results (GoogleNet)

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I used pretrained GoogleNet from https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet and finetuned it with my own data (~ 100k images, 101 classes). After one day training I achieved 62% in top-1 and 85% in top-5 classification and try to use this network to predict several images. I just followed example from https://github.com/BVLC/caffe/blob/master/examples/classification.ipynb , Here is my Python code: import caffe import numpy as np caffe_root = './caffe' MODEL_FILE = 'caffe/models/bvlc_googlenet/deploy.prototxt' PRETRAINED

How to save glm result without data or only with coeffients for prediction?

て烟熏妆下的殇ゞ 提交于 2019-12-03 07:28:07
When I use the following R code, model_glm=glm(V1~. , data=xx,family="binomial"); save(file="modelfile",model_glm); The size of modelfile will be as much as the data, which will be 1gig in my case. How can I remove the data part in the result of model_glm, so I can only save a small file. Setting model = FALSE in your call to glm should prevent the model.frame from being returned. Also setting y = FALSE will prevent the response vector from being returned. x = FALSE is the default setting and prevents the model.matrix from being returned. This combination should shrink the size of your glm