regression

Finding the optimal combination of inputs which return maximal output for a black box model

筅森魡賤 提交于 2021-02-10 05:24:06
问题 One of the challenges that I have been facing when applying ANN to regression tasks on my job is that in order to find the optimal out for a given range of inputs, I have to feed a multidimensional meshgrid to my model and then simply pick the highest value. However, this is overall a very computationally costly solution. The lenght of the text bellow might be scary but it just my attempt to better explain it. Let me explain with other words. Supposing that I have 9 inputs for my ANN, and

Error with using the mlogit R function: the two indexes don't define unique observations

落爺英雄遲暮 提交于 2021-02-10 05:14:06
问题 I've got a problem with the mlogit funtion in R. My dataset looks like this: personID caseID altID choice a1 a2 a3 a4 1 1 1 1 3 0 3 1 1 1 2 0 1 3 0 1 1 1 3 0 4 4 4 4 1 2 1 0 2 2 1 3 1 2 2 1 2 3 1 3 etc.... I've tried running the following code, performing the model. setV2 <- mlogit.data(data = setV2, choice = "choice", shape = "long", alt.var = "altID", chid.var = "personID") m <- mlogit(choice ~ a1 + a2 + a3 + a4 | -1, rpar = c(a1 = "n", a2 = "n", a3 = "n", a4 = "n"), correlation = FALSE,

Error with using the mlogit R function: the two indexes don't define unique observations

我的未来我决定 提交于 2021-02-10 05:12:36
问题 I've got a problem with the mlogit funtion in R. My dataset looks like this: personID caseID altID choice a1 a2 a3 a4 1 1 1 1 3 0 3 1 1 1 2 0 1 3 0 1 1 1 3 0 4 4 4 4 1 2 1 0 2 2 1 3 1 2 2 1 2 3 1 3 etc.... I've tried running the following code, performing the model. setV2 <- mlogit.data(data = setV2, choice = "choice", shape = "long", alt.var = "altID", chid.var = "personID") m <- mlogit(choice ~ a1 + a2 + a3 + a4 | -1, rpar = c(a1 = "n", a2 = "n", a3 = "n", a4 = "n"), correlation = FALSE,

Error in plm function: 'names' attribute [343] must be the same length as the vector [0]

孤街醉人 提交于 2021-02-08 12:13:44
问题 I am running a panel regression using 'plm' function using the following code: test_reg=plm(y~x1+x2+x3+x4*x7+x5*x7+x6*x7+x8+x9+x10+x11,DATA, index = c("year","id"),model ="within") summary(test_reg) Then I get the following error: Error in names(y) <- namesy : 'names' attribute [343] must be the same length as the vector [0] However, when I switch the y variable and x10 variable and run the same 'plm' function again, I do not get such an error and it works well like: test_reg=plm(x10~x1+x2+x3

how to use loop to do linear regression in R

依然范特西╮ 提交于 2021-02-08 12:13:40
问题 I wonder if I can use such as for loop or apply function to do the linear regression in R. I have a data frame containing variables such as crim, rm, ad, wd. I want to do simple linear regression of crim on each of other variable. Thank you! 回答1: If you really want to do this, it's pretty trivial with lapply() , where we use it to "loop" over the other columns of df . A custom function takes each variable in turn as x and fits a model for that covariate. df <- data.frame(crim = rnorm(20), rm

Write a function to list all possible combinations of models

邮差的信 提交于 2021-02-08 11:59:49
问题 I'm attempting to write a function to run all possible regression models for variables in a dataset. I was able to get it to run each variable, this is what I have so far. library(tidyverse) library(broom) data("mtcars") model1 <- function (DATA) { DATA %>% map(~lm(mpg ~ .x, data = DATA), tidy)%>% map(summary) %>% map_dbl("adj.r.squared") %>% tidy %>% rename(adj.r.squared = x) } model1(mtcars) I am new to R and writing functions so I am sure there are some issues with it. I want a tibble of

I am using rational regression to fit my data, how do I know what polynomials to divide?(What function to use?)

别等时光非礼了梦想. 提交于 2021-02-08 10:17:35
问题 I have a set of data: 10.28;3.615758755 60.12;3.409846973 87.24;2.360958276 92.37;2.288513587 130.87;1.940551693 164.01;1.770745686 215.87;1.60957984 245.42;1.548268275 251.26;1.53780944 252.14;1.536289363 261.74;1.520210896 384.91;1.385778494 458.68;1.339844772 492.59;1.323331777 600.94;1.281642094 6480.17;1.116976869 849.37;1.229511285 941.5;1.216845459 1280.98;1.185881122 1395.94;1.178804247 1470.04;1.180831814 1500.85;1.179158477 1861.04;1.15910996 2882.22;1.138164332 2997.18;1.136701833

Prediction of a discrete numerical target. Multiclass Classifier or Regressor?

喜夏-厌秋 提交于 2021-02-08 10:16:24
问题 In brief, I am trying to come up with a ML (and later DL model) for predicting control input variable of my computer simulation model, based on all other model input variables - let's call them environmental variables. Whether the simulation gives a convergent result or not depends on the value of the control variable. The database for the problem has been generated in a long, iterative simulation run with different scenarios. It consists of all environmental inputs, the control input value,

Prediction of a discrete numerical target. Multiclass Classifier or Regressor?

旧城冷巷雨未停 提交于 2021-02-08 10:15:22
问题 In brief, I am trying to come up with a ML (and later DL model) for predicting control input variable of my computer simulation model, based on all other model input variables - let's call them environmental variables. Whether the simulation gives a convergent result or not depends on the value of the control variable. The database for the problem has been generated in a long, iterative simulation run with different scenarios. It consists of all environmental inputs, the control input value,

XGBoost Error info.labels.size() != 0U (0 vs. 0)

北慕城南 提交于 2021-02-08 09:16:13
问题 I am trying to run a regression problem on python using XGBOOST: import xgboost global clf clf = XGBRegressor(n_estimators = 500, learning_rate = 0.05, max_depth=6, n_jobs=4, alpha = 0.1) clf.fit(X_train, y_train, early_stopping_rounds = 5, eval_set = validation, verbose=False) predicted_test_tr = np.round(clf.predict(X_test)) But it raises the following error, after a few iterations: XGBoostError: b'[10:56:23] src/objective/regression_obj.cc:43: Check failed: info.labels_.size() != 0U (0 vs.