Error In Terms.formulaformula Data = Data
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack
R Error In Terms.formula(formula, Data = Data) : '.' In Formula And No 'data' Argument
Overflow the company Business Learn more about hiring developers or posting ads with us Stack error in neurons[[i]] %*% weights[[i]] : requires numeric/complex matrix/vector arguments Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community error in terms.formula(formula data = data) invalid model formula of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error in terms.formula(formula) : '.' in formula and no 'data' argument up vote 15 down vote favorite
Predict Neural Network In R
1 I'm tring to use neuralnet for prediction. Create some X: x <- cbind(seq(1, 50, 1), seq(51, 100, 1)) Create Y: y <- x[,1]*x[,2] Give them a names colnames(x) <- c('x1', 'x2') names(y) <- 'y' Make data.frame: dt <- data.frame(x, y) And now, I got error model <- neuralnet(y~., dt, hidden=10, threshold=0.01) error in terms.formula(formula) : '.' in formula and no 'data' argument For example, in lm(linear model) this is worked.
Error In Terms Formula Formula Data Data Attempt To Use Zero Length Variable Name
r formula prediction share|improve this question edited Jul 22 '13 at 18:22 Gavin Simpson 104k13209304 asked Jul 22 '13 at 18:18 luckyi 10029 3 neuralnet is doing a lot os messing with the formula via non-exported function neuralnet:::generate.initial.variables. There is a bug in that function. I suggest you contact the maintainer and send them this example or a link to the question. –Gavin Simpson Jul 22 '13 at 18:28 add a comment| 1 Answer 1 active oldest votes up vote 23 down vote accepted As my comment states, this looks like a bug in the non-exported function neuralnet:::generate.initial.variables. As a work around, just build a long formula from the names of dt, excluding y, e.g. n <- names(dt) f <- as.formula(paste("y ~", paste(n[!n %in% "y"], collapse = " + "))) f ## gives > f y ~ x1 + x2 ## fit model using `f` model <- neuralnet(f, data = dt, hidden=10, threshold=0.01) > model Call: neuralnet(formula = f, data = dt, hidden = 10, threshold = 0.01) 1 repetition was calculated. Error Reached Threshold Steps 1 53975276.25 0.00857558698 1967 share|improve this answer answered Jul 22 '13 at 18:33 Gavin Simpson 104k13209304 thanks, this is nice solution! –luckyi Jul 23 '13 at 9:22 sorry, but I can't und
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and neural net prediction r policies of this site About Us Learn more about Stack Overflow the
Error In Neurons[[i]] %*% Weights[[i]] : Non-conformable Arguments
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags error in eval(predvars, data, env) : invalid 'envir' argument of type 'character' Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes http://stackoverflow.com/questions/17794575/error-in-terms-formulaformula-in-formula-and-no-data-argument a minute: Sign up Object not found error when passing model formula to another function up vote 5 down vote favorite 2 I have a weird problem with R that I can't seem to work out. I've tried to write a function that performs K-fold cross validation for a model chosen by the stepwise procedure in R. (I'm aware of the http://stackoverflow.com/questions/8218196/object-not-found-error-when-passing-model-formula-to-another-function issues with stepwise procedures, it's purely for comparison purposes) :) Now the issue is, that if I define the function parameters (linmod,k,direction) and run the contents of the function, it works flawlessly. BUT, if I run it as a function, I get an error saying the datas.train object can't be found. I've tried stepping through the function with debug() and the object clearly exists, but R says it doesn't when I actually run the function. If I just fit a model using lm() it works fine, so I believe it's a problem with the step function in the loop, while inside a function. (try commenting out the step command, and set the predictions to those from the ordinary linear model.) #CREATE A LINEAR MODEL TO TEST FUNCTION lm.cars <- lm(mpg~.,data=mtcars,x=TRUE,y=TRUE) #THE FUNCTION cv.step <- function(linmod,k=10,direction="both"){ response <- linmod$y dmatrix <- linmod$x n <- length(response) datas <- linmod$model form <- formula(linmod$call) # generate indices for cross validation rar <- n/k xval.idx <- list() s <- sample(1:n, n) # permutation of 1:n for (i in 1:k) { xval.idx[[i]] <- s[(ceiling(rar*(i-1))+1):(ceiling(rar*i))] } #error c
ProgrammingWhat is the meaning of the error "Error in terms.formula (formula) : '.' in formula and no 'data' argument" in R? This error came in when I was using neuralnet function.UpdateCancelAnswer Wiki1 Answer Peter Flom, Sometime user of https://www.quora.com/What-is-the-meaning-of-the-error-Error-in-terms-formula-formula-in-formula-and-no-data-argument-in-R-This-error-came-in-when-I-was-using-neuralnet-function R, especially for graphs.Written 103w agoUser gave a good answer. My own answer is that, like most R error messages, it is designed to say "I am really smart and you are not so good luck https://www.biostars.org/p/179334/ figuring out what the error message means. I have better things to do than write clear error messages for people like you"I am partly joking. However, once, on r-help, a certain well known person was asked error in why he gave such nasty replies to so many questions and he said that he wanted to discourage newbies from asking questions.Truly, R has been described as "expert friendly".1.8k Views · View UpvotesView More AnswersRelated QuestionsWhat is the best way to plot mean with standard error in bar using R?What is the formula for experimental error?How do we derive the formula for standard error of sample mean?What kind of error exists in the error in terms formula C=C*D/C?What are the formulas for diversified and undiversified tracking errors by giving tracking errors of each single funds and their assets alloca...What does the JavaScript error "is not a function" mean?What is the general term formula of such recursive function?When I came across ANOVA, the instructor talked about DF (error), SS (error), etc. What do these error terms indicate?In R programming, when you use apply function in the following way (apply (store.df, 2,mean-median) why does it return an error?What exactly does the error_reporting function do in PHP and what does error level mean?How does error function work?How do I use the MSE (mean square error) and AFER (average forecasting error rate) for predicting and analysis of numerical data?What does the error message "NA/NaN/Inf in foreign function call (arg 6)" mean in the R language?Data Mining: Why am I getting this error when using the k-means: error number of cluster centres must lie between 1 and nrow(x)?What does this error mean?How can I calculate the mean squared error (MSE) after using lars function for fitting lasso model?What does error 605 mean?I'm working on a project regarding Twitter sentiment analysis using R language. I'm stuck with the following error during scoring the tweets: ...Why does RandomForest in R show error "long vectors (argument 24) are not supported i
faq • rss Community Log In Sign Up Add New Post Question: Neuralnet on R 0 7 months ago by bruna.zamith • 0 bruna.zamith • 0 wrote: Dear all, That is my first experience with neural networks so I appreciate any possible help or tips. I have a datset with 332 columns providing integer infomation, such as 0 or 1 (binary). The last column classifies each example (row) in a superfamily. For example, row 1: 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 Superfamily1 row 2: 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 Superfamily2 What I am trying to do is, based on the binary information (all columns except the last one), predict the Superfamily. I have a train dataset and a test one. I have tried doing that: *attach(train) creditnet <- neuralnet(Superfamily~., train, hidden = 4, lifesign = "minimal", linear.output = FALSE, threshold = 0.1)* But I get an error message: *Error in terms.formula(formula) : '.' in formula and no argument 'data'* What should I do? What am I doing wrong? Thank you in advance! machinelearning neuralnetworks R • 593 views ADD COMMENT • link • Not following Follow via messages Follow via email Do not follow modified 7 months ago by russhh • 1.7k • written 7 months ago by bruna.zamith • 0 0 7 months ago by russhh • 1.7k UK, U. Glasgow russhh • 1.7k wrote: Neuralnet doesn't appear to like that formula shorthand As an example: library(neuralnet) data(iris) iris$Species <- with(iris, Species == 'setosa') # making some binary variable neuralnet(Species ~ ., data = iris) # Error in terms.formula(formula) : '.' in formula and no 'data' argument cn <- paste(colnames(iris)[1:4], collapse = ' + ') cn # [1] "Sepal.Length + Sepal.Width + Petal.Length + Petal.Width" fo <- as.formula(paste('Species', '~', cn)) # define the formula fo # Species ~ Sepal.Lengt