Building a rational Gradient Boosting Model for regression
I am working on estimation of house price. The dataset has 26 features such as area, age, elevator, parking, etc. I have trained a Gradient Boosting model for regression and the performance of the model is almost acceptable, but the problem is that for some features the relation between the features and the predicted values is not rational. For example by increasing the age of a building, we always expect that the price of the house decrease. Although in the dataset it doesn't always happen but the trend is descending as I expect; or I expect the predicted price for a house which has elevator to be always more than a similar house without elevator, but for a lot of samples it doesn’t happen. How can I enforce the model to have rational correlation between attributes and predictions?
do you know?
how many words do you know
See also questions close to this topic

How to replace values in pandas dataframe
My goal is to design a program that will take create a program that will replace unique values in a pandas dataframe.
The following code performs the operation
# replace values print(f" {s1['A1'].value_counts().index}") for i in s1['A1'].value_counts().index: s1['A1'].replace(i,1) print(f" {s2['A1'].value_counts().index}") for i in s2['A1'].value_counts().index: s2['A1'].replace(i,2) print("s1 after replacing values") print(s1) print("******************") print("s2 after replacing values") print(s2) print("******************")
Expected: The values in the first dataframe
s1
should be replaced with 1s. The values in the second dataframes2
should be replaced with 2s.Actual:
Int64Index([8, 5, 2, 7, 6], dtype='int64') Int64Index([2, 8, 5, 6, 7, 4, 3], dtype='int64') s1 after replacing values A1 A2 A3 Class 3 5 0.440671 2.3 1 9 8 0.070035 2.9 1 14 2 0.868410 1.5 1 29 6 0.587487 2.6 1 34 8 0.652936 3.0 1 38 8 0.181508 3.0 1 45 8 0.953230 3.0 1 54 7 0.737604 2.7 1 68 5 0.187475 2.2 1 70 5 0.511385 2.3 1 71 8 0.688134 3.0 1 73 2 0.054908 1.5 1 87 8 0.461797 3.0 1 90 2 0.756518 1.5 1 91 2 0.761448 1.5 1 93 5 0.858036 2.3 1 94 5 0.306459 2.2 1 98 5 0.692804 2.2 1 ****************** s2 after replacing values A1 A2 A3 Class 0 2 0.463134 1.5 3 1 8 0.746065 3.0 3 2 6 0.264391 2.5 2 4 2 0.410438 1.5 3 5 2 0.302902 1.5 2 .. .. ... ... ... 92 5 0.775842 2.3 2 95 5 0.844920 2.2 2 96 5 0.428071 2.2 2 97 5 0.356044 2.2 3 99 5 0.815400 2.2 3
Any help understanding how to replace the values in these dataframes would be greatly appreciated. Thank you.

Conda environment missing dependencies when trying to download THOR tracker
I am new to linux in general and I've recently got into vision coding. I am trying to download the THOR real time tracker from
https://github.com/xlsr/THOR
.While trying to make the conda environment I have got a missing dependencies error:
~/Downloads/THOR$ conda env create f environment.yml Solving environment: failed ResolvePackageNotFound:  cacertificates==2019.1.23=0  freetype==2.9.1=h8a8886c_1  ninja==1.9.0=py37hfd86e86_0  openssl==1.1.1c=h7b6447c_1  libgccng==8.2.0=hdf63c60_1  mkl==2019.4=243  readline==7.0=h7b6447c_5  libstdcxxng==8.2.0=hdf63c60_1  cudatoolkit==10.0.130=0  mkl_random==1.0.2=py37hd81dba3_0  olefile==0.46=py37_0  six==1.12.0=py37_0  pytorch==1.1.0=py3.7_cuda10.0.130_cudnn7.5.1_0  mkl_fft==1.0.12=py37ha843d7b_0  intelopenmp==2019.4=243  libffi==3.2.1=hd88cf55_4  cffi==1.12.3=py37h2e261b9_0  zstd==1.3.7=h0b5b093_0  numpybase==1.16.4=py37hde5b4d6_0  sqlite==3.28.0=h7b6447c_0  python==3.7.3=h0371630_0  jpeg==9b=h024ee3a_2  torchvision==0.3.0=py37_cu10.0.130_1  pillow==6.0.0=py37h34e0f95_0  libpng==1.6.37=hbc83047_0  ncurses==6.1=he6710b0_1  libedit==3.1.20181209=hc058e9b_0  libgfortranng==7.3.0=hdf63c60_0  libtiff==4.0.10=h2733197_2  zlib==1.2.11=h7b6447c_3  xz==5.2.4=h14c3975_4  numpy==1.16.4=py37h7e9f1db_0  blas==1.0=mkl
I have tried downloading a few of them with
sudo install
,pip
orconda
but the required version is not found or the package at all. The tracker is from 2019 and I do not think it has been updated since, but this is the best real time tracker I have found that does not require recognition and training which is exactly what I am looking for. I would appreciate any help or suggestions for other trackers that use GPU and do not need training and recognition. 
How to understand a code to calculate fluxes
I am unable to understand how this code work. Where window is a line with two points. Window is where we calculate the flux. I want to understand how exactly the code is working
times = np.zeros((len(x)), dtype=int) center_x, center_y = 0.5 * (window.point1[0] + window.point2[0]), 0.5 * (window.point1[1] + window.point2[1]) safety_value = 3.0 radius = safety_value * 0.5 * (math.sqrt((window.point1[0]  window.point2[0])**2 + (window.point1[1]  window.point2[1])**2)) # fictive boaders left_boarder, right_boarder = center_x  radius, center_x + radius bottom_boarder, up_boarder = center_y  radius, center_y + radius i = 1 while (i < len(x)1): if (left_boarder <= x[i] <= right_boarder) and (x[i] > x[i1]) and np.sign(window.perpendicular_distance_unnormalized(x[i], y[i])) != np.sign(window.perpendicular_distance_unnormalized(x[i1], y[i1])) and window.is_point_on_segment(x[i], y[i]) and window.is_point_on_segment(x[i1], y[i1]): times[i] += 1 i += 1 else: i += 1 return times
result = 0 for i in range(y_min, y_max): result += UX[x_, i] return result def calculate_vel_fluxes(ux, windows): vel_fluxes = np.empty((len(windows), ux.shape[0])) for i in range(len(windows)): for j in range(ux.shape[0]): vel_fluxes[i, j] = uFlux(ux[j], windows[i]) return vel_fluxes

Error Message  Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
I am recoding categorical variables into binary outcomes for a logistic regression experiment. (seeing how select independent variables impact self reported health satisfaction in Britain)
Upon recoding using dplyr I get the error message  Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
Please refer to the below code and if anybody could suggest an lteration to my code to eliminate Na's in my new binary output it would be appreciated
projectdata$c_employ < recode_factor(projectdata$c_employ,"no"=0, "yes"=1) summary(projectdata$c_employ)
output:
0 1 NA's 20514 25381 8
(How do I change the above code to get rid of NA variables that I don't want in my binary output)

Tuning parameters for multiple regression models
So I am trying to compare multiple regression algorithms to estimate biomass. While it is somewhat simple if parameters are ignored, if I want to be rigorous, I am gonna have to tune every parameter of every regression model using gridsearchcv, not to mention the number of parameter dictionaries that I am gonna have to create for each regression model before applying gridsearchcv. Is there a way to facilitate this procedure, like maybe a library that I don't know of, a way to automate gridsearchcv for all models, a solution for the parameter dilemma...? Thank you in advance.

Issue in censored regression in R
I have this task at hand. I have to run multiple censored regression and report on the bias in each case.
To do this, my question first tells me to simulate normally distributed
x
ande
values, run a regression (b0 and b1 set to 2 and 1) with the formulay = b0 + b1*x + e
and then run a regression withlm
using the generatedy
values. This was done in order to see if there were any differences in the parameter values for b0 and b1 when running a regression. There were not. Also, I generated the values forx
ande
withrnorm
Next, the question asks to censor the
y
values, such that ify < 0
then the censored variableyc = 0
else,yc = y
After doing this, it asks to run a censored regression and report on the bias. I did this by first using
censReg
from thecensReg
package, however I ran into an error:Error in eigen(hess, symmetric = TRUE, only.values = TRUE) : infinite or missing values in 'x'
when calling thesummary.censReg
function. I then usedtobit
from theAER
package and could avoid the issue.However, my main issue is that the call from the
tobit
function is giving me the same parameter values, i.e.,b0 = 2, b1 = 1
. Is this supposed to be the case? Since my question asks me to report on the bias, I think there should be.Thank you for any help :)
set.seed(420) library(censReg) library(tidyverse) library(AER) # We first simulate a data for y by generating random, normally distributed data x < rnorm(5000) error < rnorm(5000) b0 = 2 b1 = 1 mean(x) var(x) y = b0 + b1*x + error y1 = lm( y ~ x + error) summary(y1) cens < tobit(yc ~ x + error, data = df, dist = "gaussian") summary(cens) Call: tobit(formula = yc ~ x + error, dist = "gaussian", data = df) Observations: Total Leftcensored Uncensored Rightcensored 5000 4609 391 0 Coefficients: Estimate Std. Error z value Pr(>z) (Intercept) 2.000e+00 1.120e04 17862 <2e16 *** x 1.000e+00 4.321e05 23143 <2e16 *** error 1.000e+00 4.625e05 21622 <2e16 *** Log(scale) 7.719e+00 0.000e+00 Inf <2e16 ***  Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Scale: 0.0004442 Gaussian distribution Number of NewtonRaphson Iterations: 30 Loglikelihood: 2632 on 4 Df Waldstatistic: 5.795e+08 on 2 Df, pvalue: < 2.22e16

Add Gradient to Label of BottomNavigationBarItem
In my flutter app I have a bottom navigation bar. I want to add a LinearGradient to the selected item.
I managed to add a Gradient to the Icon by using the
activeIcon
attribute of BottomNavigationBarItem.However I don't know how to add the same gradient to the label of the item. Since
BottomNavigationBarItem.title
is deprecated andBottomNavigationBarItem.label
only allows me to add a String I can not add the Gradient to the label directly.I have tried messing with the
selectedLabelStyle
of the BottomNavigationBar but had no success.Here is a screenshot of how my BottomNavigationBar looks. Currently the Label has a single color. I want it to have the same gradient as the icon.
Does anyone know how I can achieve this?
Thank you very much!
BottomNavigationBar( onTap: onTabTapped, currentIndex: _currentPage, backgroundColor: context.appTheme.primaryBackgroundColor, type: BottomNavigationBarType.fixed, unselectedItemColor: context.appTheme.primaryTextColor, showUnselectedLabels: true, items: [ BottomNavigationBarItem( activeIcon: GradientMask( child: Icon(Icons.home_filled), gradient: context.appTheme.primaryGradient, ), icon: Icon(Icons.home_filled), label: 'Home', ), BottomNavigationBarItem( activeIcon: GradientMask( child: Icon(Icons.search), gradient: context.appTheme.primaryGradient, ), icon: Icon(Icons.search), label: 'Search', ), BottomNavigationBarItem( activeIcon: GradientMask( child: Icon(Icons.savings), gradient: context.appTheme.primaryGradient, ), icon: Icon(Icons.savings), label: 'Earnings' ), BottomNavigationBarItem( activeIcon: GradientMask( child: Icon(Icons.volunteer_activism), gradient: context.appTheme.primaryGradient, ), icon: Icon(Icons.volunteer_activism), label: 'Sharing' ), BottomNavigationBarItem( activeIcon: GradientMask( child: Icon(Icons.inventory_2), gradient: context.appTheme.primaryGradient, ), icon: Icon(Icons.inventory_2), label: 'My Items' ) ], ),

Recharts: Different gradient for each bar in barchart
How is it possible to have different gradient color for each bar like this?
I could give different solid color for each bar by following this answer. I tried to include
<lineargradient>
component inside the map function and setstopcolor
according to the index. But could not achieve it. Seems like I have to define the<lineargradient>
component outside the<Bar>
component.This is the code I tried:
const barColors = [ '#4c5f7c', '#dc2424', '#fcda00', '#8383ba', '#23dbbd' ]; <Bar dataKey='pv' radius={40}> {data.map((entry, index) => ( <React.Fragment> <defs> <linearGradient id='colorUv' x1='0' y1='0' x2='100%' y2='0' spreadMethod='reflect'> <stop offset='0' stopColor='#1a1a1a' /> <stop offset='1' stopColor={barColors[index]} /> </linearGradient> </defs> <Cell key={`cell${index}`} fill='url(#colorUv)' /> </React.Fragment> ))} <LabelList dataKey='pv' position='insideRight' fill='#f5f5f5' /> <LabelList dataKey='name' position='insideLeft' fill='#f5f5f5' /> </Bar>

HR gradient is not taking effect
I can't tell my HR gradient is not taking effect or even displaying.
hr.green { margintop: 20px; marginbottom: 20px; border: 1px dashed; borderleft: 0; borderbottom: 0; borderright: 0; borderimage: lineargradient(90deg, rgba(48, 183, 149, 1) 10%, rgba(130, 195, 65, 1) 100%) !important; borderimageslice: 1; } body { backgroundcolor:black; }
<h1> TEST </h1> <hr class="green">
Did I have a typo somewhere?
I was hoping to see something like this.

Find the optimal number of boosting steps in R package "xgboost"
I'm using the R package "xgboost". I want to optimize the number of boosting steps (ideally using crossvalidation), because this parameter is likely most important in boosting models. The default values should be used for all other (tuning) parameters. What would be the simplest way to do this?

How to increase the weight of observation in boosting regression
How to increase the weight of observation in boosting regression, like for boosting classification, you could add more weights to the observations who predict wrong but for boosting regression, how could you know which observation is wrong and add weights towards them? Do we have an error range for boosting regression or so?