1,596 questions
1
vote
1
answer
469
views
Accessing predictions when using k_argmax() instead of predict_classes()
I've created a CNN in RStudio using keras to predict MNIST digits. I am now trying to predict with this model, since predict_classes() was deprecated, I'm attempting to use k_argmax() with the ...
0
votes
3
answers
815
views
predict_classes() deprecated in R, what to use instead?
I've created a CNN in RStudio using keras to predict MNIST digits. I am now trying to predict with this model using the following code
cnn_pred <- cnn_model %>%
predict_classes(x_test)
but ...
0
votes
2
answers
134
views
Getting predictions from mlrcs function in merlin package in R
I am using the mlrcs function in the merlin package to fit a restricted cubic spline model with a random variable. The model works great, but there does not seem to be any functionality for getting ...
1
vote
0
answers
274
views
lcmm::predictClass with l-spline link function
I am getting an error message trying to predict class membership in lcmm::predictClass(). This seems to be due to using a spline-based link function, as exemplified below. The lcmm::predictClass() ...
0
votes
1
answer
198
views
R: Add predictions to row-wise linear regressions
I have three data sets, which one can generate as follows:
library(dplyr)
library(tidyr)
# Simulate x data
countries = LETTERS[1:3]
mat_x = matrix(runif(27, 0, 100), nrow = 3)
colnames(mat_x) = ...
0
votes
1
answer
732
views
how to convert binary file to pandas dataframe
I use Amazon Sagemaker for model training and prediction. I have a problem with the returned data with predictions. I am trying to convert prediction data to pandas dataframe format.
After the model ...
0
votes
0
answers
58
views
Regression model equation reconstruction with random effects
I ask the community for help on the following problem.
Suppose we estimate the following regression model with fixed effects Age (factor variable) and Year (factor variable) as random effects.
set....
0
votes
0
answers
69
views
How to predict any combination of strings that can occur with given strings?
I have some strings in my dataframe and I have replaced it.
df2['x'].replace(['APPEAL','AppealNo.','AppealNO.','Co.Appeal','COMP.APPL','Co.Appeal','Comp.','AppealNo','CoAppealnies','CoAppealnies','...
0
votes
1
answer
470
views
Predict() applied to a neural network model does not work
currently Im performing a statistical learning analysis on a given dataset (redwine quality); the goal is to predict the quality value. I already tried the logistic regression and the random forest ...
1
vote
0
answers
400
views
How to print content of "generator object Estimator.predict"
I have a variable which is <generator object Estimator.predict at 0x7fc2de02ef20>. It's the result of my_predictions = estimator.predict(input_fn=functools.partial(ds.eval_input_fn, params)).
...
1
vote
1
answer
702
views
How do I extract standard errors or variation from predicted ordinal logistic regression analyses?
I am undertaking a ordinal logistic regression using R package MASS.
For example:
library(MASS)
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
summary(house.plr, digits ...
1
vote
1
answer
123
views
How to transpose result of colmeans in R to pass into linear regression function?
I have a model in R:
lm(formula = Y ~ rowmeans(df[, c(10:14)]), data=df)
I want to fit this against the means of columns 10:14 so that my output has 5 rows to predict the Y values.
I'm calculating ...
0
votes
1
answer
901
views
Error in UseMethod "predict" when running Random Forest model
Looking for feedback on the error below. I built a Random Forest classification model a couple years ago, and now I'm simply trying to run it again in rStudio on a new set of data. Hoping someone can ...
1
vote
3
answers
1k
views
Solving a linear model for a known value of y in R
I have a series of x and y values that I've used to build a linear model.
I can use predict() to find a value of y from a known value of x, but I'm struggling to calculate x from a known value of y. ...
0
votes
1
answer
1k
views
Trying to predict, prediction value greater than 0.5 it will be positive prediction (1) , under 0.5 value as 0 ,negative , but having problem in loop
After training the model , evaluating prediction that is on dtype=float32.
y_pred = model.predict(x_test)
y_pred
array([[0.952564 ],
[0.40119413],
[0.8223132 ],
...,
[0....
2
votes
1
answer
185
views
Should I provide x or log(x) to predict() if my model is y ~ log(x)?
I have a fitted lm model
log_log_model = lm(log(price) ~ log(carat), data = diamonds)`
I want to predict price using this model, but I'm not sure if I should be entering log(carat) or carat value as ...
0
votes
0
answers
216
views
ELISA in R: how to use curve-specific estimates when applying the ED function to a drc obejct?
Assume that we would like to estimate the concentrations of 2000 samples (500 individuals with 4 samples each) from their observed absorptions. The relationship between absorption and concentration is ...
0
votes
1
answer
1k
views
how to update prophet model with new data added to the old data set? I tried the tutorial but I get errors
So I tried the one in FbProphet tutorial website:
https://facebook.github.io/prophet/docs/additional_topics.html#updating-fitted-models
I got this error: RuntimeError: mismatch in dimension declared ...
0
votes
0
answers
103
views
Generate and assemble model predictions for each stratified kfold test split
I would like to generate multiple test data splits using stratified KFold (skf) and then generate/assemble predictions for each of these test data splits (and hence all of the data) using a sklearn ...
0
votes
1
answer
256
views
inputs of 2 separate predict() return the same set of fitted values
Confession: I attempted to ask this question yesterday, but used a sample, congruent dataset which resembles the my "real" data in hopes this would be more convenient for readers here. One ...
0
votes
1
answer
48
views
predict() "appears" to render two different subsets as the same exact values
I am in the process of self-educating myself in R, and attempting to use the predict() for the first time. My objective is creating a linear model of two predicted vectors: "yC.hat", and &...
2
votes
2
answers
6k
views
How to use .predict() in a Linear Regression model?
I'm trying to predict what a 15-minute delay in flight departure does to the flight's arrival time. I have thousands of rows as well as several columns in a DF. Two of these columns are dep_delay and ...
2
votes
1
answer
435
views
Plot_cap response curve for counterfactual data
The following code was made up to replicate my problem with a bigger, more complex data set.
library(marginaleffects)
library(truncnorm)
yield_kgha<-rtruncnorm(n=100, mean=2000, sd=150)
n_kgha<-...
-1
votes
1
answer
707
views
Carrying out an LDA and predict data
I had the following dataset
library(MASS)
install.packages("gclus")
data(wine)
View(wine)
install.packages("car")
I wanted to split it according to the proportions 70:30 into a ...
0
votes
1
answer
35
views
Coalescing columns more efficiently in R
I have 2 dataframes - the first dataframe (df1) has columns with values at different times of the year; these columns are ones that don't have stationary or Air in the column name. I used a linear ...
2
votes
1
answer
78
views
How to run linear models, and use predict function more efficiently?
I have a dataframe that looks like so:
df = structure(list(Date_Time_GMT_3 =
structure(c(1622552400, 1622553300,1622554200, 1622555100, 1622556000, 1622556900),
...
0
votes
1
answer
36
views
A question about using CNN network, changing data as 4-dim
I tried to import pictures from the camera and I could get 3-dim data from the image.
img = WebcamModule.getImg(True, size=[240,120])
img = image.img_to_array(img)
then, from the code below I ...
1
vote
1
answer
574
views
Cannot use coxph.predict for type="expected" with newdata in Competing Risks context
I'm using a Cox Proportional Hazards (survival::coxph) model in a competing risks context- i.e. multiple event types with one endpoint for each observation. I'm having a hard time using the coxph....
0
votes
1
answer
75
views
Problems with predict() using new data
My problem goes as follows. I have the following dataset.
This is Ibex (Spanish stockmarket) ranging from 2020-01-01 to 2022-05-01
tail(ibex, 3)
Date
Open
High
Low
Close
Adj.Close
Volume
2022-04-01
...
0
votes
0
answers
67
views
ValueError: Found input variables with inconsistent numbers of samples: [225, 842]
import matplotlib.pyplot as plt
import pandas as pd
import pylab as pl
import numpy as np
pd.set_option("display.max_columns", None)
df = pd.read_csv(r"C:\Users\kiaab\Downloads\...
0
votes
1
answer
194
views
Error in R with the MAPE function, how can I solve?
I build a model
model.5 <- lm(formula = rent ~ area + rooms + age + nationality + maritalstat + education + traveltime + region + center, data=mysample)
and now I did the prediction
sel <- is....
1
vote
1
answer
537
views
Can I use predict() to predict INDEPENDENT variable from dependent variable in a model?
I have a growth rate model:
model <- nls(Length~a*exp(-b*exp(-c*Age)), data=df, start=list(a=160,b=0.5, c=0.1))
> summary(model)
Formula: Length ~ a * exp(-b * exp(-c * Age))
Parameters:
...
2
votes
2
answers
206
views
Generating sliding window to subset data for prediction task
I want to write a sliding window function in order to use the model trained from t, t+1, and t+2 year to make prediction on the outcome of the t+3 year. This means that for a 10-year's data, the ...
1
vote
1
answer
913
views
R - ggplot - geom_ribbon() makes spikey / jagged plot for groups
I'm working with a growth curve model (generated with lmer) and would like to add confidence intervals to the model plot using geom_ribbon(). (The full R code can be downloaded here and the data set ...
-1
votes
1
answer
425
views
fill in NA values with predicted values from linear regression for grouped data in R
I want to fill in NAs in the prop_below5 variable for those depths (depth_round) where I don't have measurements using a linear interpolation and keep the actual measured value when available. I want ...
1
vote
0
answers
609
views
Predicting a GAM in R with an offset
I am trying to predict the output of two GAMs using the package mgcv and the predict() function and for some reason one output has the smooth prediction I am looking for and the other does not.
My ...
0
votes
1
answer
76
views
TensorFlow optimisation during running model speed up Predict
I want to disable a computation of several filters during Predict call with Tensorflow 2 and Keras.
Do i have to modify the source code of Tensorflow to achieve that ?
0
votes
1
answer
457
views
Creating predicted vs observed confidence interval graph
Hello and thank you for you time and consideration,
I'd like to recreate this graph with ggplot.
The top blue dots are the predicted values from my fitted model na_lmod and the lower red values are ...
0
votes
0
answers
289
views
Visualising GLMM using pred() function
I applied the following GLMM to my data using glmmTMB.
M1 <- glmmTMB(Count1 ~ Count2 + Year + Location + Depth +
(1|Site/Transect),
data = df,
family = &...
0
votes
0
answers
134
views
DECISION TREES AND CONFUSION MATRIX
I have a database with the variables: recodedTime_second, OperatorStepLevel, Operator and StepType.
There are 11 operators and 16 stepTypes (tasks). The recoded time is the amount of seconds a worker ...
0
votes
1
answer
1k
views
RandomForestSRC: how to get survival probabilities for any time point?
I am using the randomForestSRC package to model some survival data. I train the model using the rfsrc function. My train data is heavily censored, the event occurs only in 1% of the cases. The ...
0
votes
3
answers
2k
views
Input 0 of layer "global_average_pooling1d" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 16)
I just started to learn Tensorflow and got an error. I watched a Neural Network Tutorial of Tech with Tim. I finished this episode and got a problem to the end. I couldn't predict the value. when i ...
4
votes
1
answer
1k
views
Predicted values for conditional logistic regression greater than 1
I have a multivariate conditional logistic regression model. Case and controls are matched on a 1 to many basis.
I want to make predictions using the model. However, the predicted values I keep ...
0
votes
0
answers
145
views
SE for logistic regression predictions
I have been tasked with calculating the SE for logistic regression point estimates (where all my predictor variables are factors). I typically use ggpredict to estimate my predictions which provides ...
0
votes
0
answers
517
views
Persistent error for .predict in the scikit-learn package "AttributeError: 'NoneType' object has no attribute 'split'"
Anytime I use .predict or fit_predict, Im encountering the same error. The following code works for others and Im guessing it has to do with my environment or my particular packages. Really appreciate ...
1
vote
0
answers
145
views
Azure SQL Managed Instance PREDICT with an ONNX model
I repeat the example from https://learn.microsoft.com/en-us/azure/azure-sql-edge/deploy-onnx
"Deploy and make predictions with an ONNX model and SQL machine learning"
In this quickstart, you'...
0
votes
1
answer
661
views
Linear regression prediction based on group of data in test set
I have a simple dataset which looks like this:
v1 v2 v3 hour_day sales
3 4 24 12 133
5 5 13 12 243
4 9 3 3 93
5 12 5 3 101
4 9 3 6 ...
0
votes
0
answers
90
views
Predict Arima with expanding window function error in R
I got some problems predicting my arima model when I use expanding window function. My code looks like this:
iTraininSet <- trunc(nrow(adj_consumption)*0.7)
iValidationSet <- trunc(nrow(...
0
votes
1
answer
482
views
How can effects from fixed-effects model in plm be plotted in R?
I cannot get a plot for the effects I get from a fixed-effects model in plm. I tried using effect(), predict() and all kinds of packages like sjPlot, etc.
Is there a way of plotting it, especially ...
0
votes
1
answer
463
views
How to use termplot function with fixed predictive variable values?
Let´s assume I want to draw a plot similar to here here using R, i.e. hazard ratio on y axis and some predictor variable on x axis based on a Cox model with spline term. The only exception is that I ...