regression

Accuracy always 1 Caffe Regression

无人久伴 提交于 2019-11-28 12:38:55
问题 My dataset contains 400 images 32x32x3 and the labels contain float number (-1,1). Example: faceCroppedImages/img1.jpg 0 faceCroppedImages/img2.jpg 0.0128 faceCroppedImages/img3.jpg 0.0128 faceCroppedImages/img4.jpg 0.0128 faceCroppedImages/img22.jpg 0.0128 faceCroppedImages/img23.jpg 0.0085 faceCroppedImages/img24.jpg 0.0077 faceCroppedImages/img25.jpg 0.0077 faceCroppedImages/img293.jpg -0.023 faceCroppedImages/img294.jpg -0.023 faceCroppedImages/img295.jpg -0.0204 faceCroppedImages/img296

how to run lm regression for every column in R

孤者浪人 提交于 2019-11-28 11:46:28
问题 I have data frame as: df=data.frame(x=rnorm(100),y1=rnorm(100),y2=rnorm(100),y3=...) I want to run a loop which regresses each column starting from the second column on the first column: for(i in names(df[,-1])){ model = lm(i~x, data=df) } But I failed. The point is that I want to do a loop of regression for each column and some column names is just a number (e.g. 404.1). I cannot find a way to run a loop for each column using the above command. 回答1: Your code looks fine except when you call

How to write multivariate logarithmic regression with Python and sklearn?

被刻印的时光 ゝ 提交于 2019-11-28 11:44:50
问题 I wrote a code for multivariate polynomial regression, I used polynomial features and transformation function from sklearn. Is it possible to make multivariate logarithmic regression? Does sklearn have some kind of logarithmic transformation, like it has for polynomial features? How can I write multivariate logarithmic regression in python? This is my code for multivariate polynomial features: import numpy as np import pandas as pd import math import xlrd from sklearn import linear_model from

Why does lm run out of memory while matrix multiplication works fine for coefficients?

做~自己de王妃 提交于 2019-11-28 10:00:58
I am trying to do fixed effects linear regression with R. My data looks like dte yr id v1 v2 . . . . . . . . . . . . . . . I then decided to simply do this by making yr a factor and use lm : lm(v1 ~ factor(yr) + v2 - 1, data = df) However, this seems to run out of memory. I have 20 levels in my factor and df is 14 million rows which takes about 2GB to store, I am running this on a machine with 22 GB dedicated to this process. I then decided to try things the old fashioned way: create dummy variables for each of my years t1 to t20 by doing: df$t1 <- 1*(df$yr==1) df$t2 <- 1*(df$yr==2) df$t3 <- 1

IC-CAD Methodology企业实战之openlava

半腔热情 提交于 2019-11-28 09:30:10
在云计算解决安全隐忧并成为IC界主流运算平台之前,私有的服务器集群系统仍然是各大IC公司的计算资源平台首选。 现在主流的服务器集群管理系统包括lsf,openlava,SkyForm,三者都属于lsf一系。lsf是IBM公司开发的服务器集群管理系统,性能优异,且有商业支持,平台组件丰富,十分易用,唯一的问题就是价格昂贵。openlava是兼容lsf的开源软件,最终版本为openlava4.0,相当于早期的lsf,其主要的用法和功能类似于lsf,因而lsf用户基本可以无缝切换到openlava,并且它开源免费免费,受到广大IC厂商的欢迎。SkyForm脱胎于openlava,后来经过天云软件的重新开发,也避免了重用IBM原始代码的侵权问题,其用法兼容与lsf和openlava,有商业支持,平台组件丰富,收费(价格应该不太贵,没有咨询过),属于一种折中的选择。 由于lsf和SkyForm收费,考虑到国内IC公司一贯勤俭节约,openlava的用户体量应该是最大的,所以本文主要针对openlava来讲,其它服务器集群管理系统有共通之处。 对IC-CAD工程师而言,对openlava需要关注一下几点。 1. openlava基本命令 2. openlava配置。 3. 硬件状况采集,机器/服务异常报警。 4. 针对用户的openlava状态(job/host/queue)信息展示系统

Recoding dummy variable to ordered factor

妖精的绣舞 提交于 2019-11-28 09:18:41
问题 I need some help with coding factors for a logistic regression. What I have are six dummy variables representing income brackets. I want to convert these into a single ordered factor for use in a logistic regression. My data frame looks like: INC1 INC2 INC3 INC4 INC5 INC6 1 0 0 1 0 0 0 2 NA NA NA NA NA NA 3 0 0 0 0 0 1 4 0 0 0 0 0 1 5 0 0 1 0 0 0 6 0 0 0 1 0 0 7 0 0 1 0 0 0 8 0 0 0 1 0 0 What I want it to look like: INC 1 INC3 2 NA 3 INC6 4 INC6 5 INC3 6 INC4 7 INC3 8 INC4 This must be a

Obtain standard errors of regression coefficients for an “mlm” object returned by `lm()`

倾然丶 夕夏残阳落幕 提交于 2019-11-28 08:28:21
问题 I'd like to run 10 regressions against the same regressor, then pull all the standard errors without using a loop . depVars <- as.matrix(data[,1:10]) # multiple dependent variables regressor <- as.matrix([,11]) # independent variable allModels <- lm(depVars ~ regressor) # multiple, single variable regressions summary(allModels)[1] # Can "view" the standard error for 1st regression, but can't extract... allModels is stored as an "mlm" object, which is really tough to work with. It'd be great

Fastest way to fit a parabola to set of points?

萝らか妹 提交于 2019-11-28 07:58:35
问题 Given a set of points, what's the fastest way to fit a parabola to them? Is it doing the least squares calculation or is there an iterative way? Thanks Edit: I think gradient descent is the way to go. The least squares calculation would have been a little bit more taxing (having to do qr decomposition or something to keep things stable). 回答1: If the points have no error associated, you may interpolate by three points. Otherwise least squares or any equivalent formulation is the way to go. 回答2

How to return predicted values,residuals,R square from lm.fit in R?

自古美人都是妖i 提交于 2019-11-28 07:49:27
this piece of code will return coefficients :intercept , slop1 , slop2 set.seed(1) n=10 y=rnorm(n) x1=rnorm(n) x2=rnorm(n) lm.ft=function(y,x1,x2) return(lm(y~x1+x2)$coef) res=list(); for(i in 1:n){ x1.bar=x1-x1[i] x2.bar=x2-x2[i] res[[i]]=lm.ft(y,x1.bar,x2.bar) } If I type: > res[[1]] I get: (Intercept) x1 x2 -0.44803887 0.06398476 -0.62798646 How can we return predicted values,residuals,R square, ..etc? I need something general to extract whatever I need from the summary? There are a couple of things going on here. First, you are better off combining your variables into a data.frame: df <-

Double clustered standard errors for panel data

帅比萌擦擦* 提交于 2019-11-28 07:48:34
I have a panel data set in R (time and cross section) and would like to compute standard errors that are clustered by two dimensions, because my residuals are correlated both ways. Googling around I found http://thetarzan.wordpress.com/2011/06/11/clustered-standard-errors-in-r/ which provides a function to do this. It seems a bit ad-hoc so I wanted to know if there is a package that has been tested and does this? I know sandwich does HAC standard errors, but it doesn't do double clustering (i.e. along two dimensions). Frank Harrell's package rms (which used to be named Design ) has a function