如何在点击li标签内的锚标签时激活特定的Li标签?(How to make particular Li tag active on click on anchor tag inside of that li tag?)
我想在点击li标签内的特定锚标签时激活我的Li标签。
这是我的代码:
<ul class="list-unstyled detail-sidemenu mrb15"> <li> <a onclick="Display1()" href="#"><span class="glyphicon glyphicon-link"></span> ABC</a> </li> <li> <a href="#" onclick="Display2()"><span class="glyphicon glyphicon-link"></span>PQR</a> </li> </ul> .detail-sidemenu li a:hover { background-color: #ed1b23; color: #ffffff; }
现在我想在Li标签上应用这个悬停类css:
function Display1() { //active ABC } function Display2() { //Active PQR and remove active from ABC }
I want to make my Li tag active when particular anchor tag inside li tag is clicked.
This is my Code:
<ul class="list-unstyled detail-sidemenu mrb15"> <li> <a onclick="Display1()" href="#"><span class="glyphicon glyphicon-link"></span> ABC</a> </li> <li> <a href="#" onclick="Display2()"><span class="glyphicon glyphicon-link"></span>PQR</a> </li> </ul> .detail-sidemenu li a:hover { background-color: #ed1b23; color: #ffffff; }
Now i want to apply this hover class css on Li tag:
function Display1() { //active ABC } function Display2() { //Active PQR and remove active from ABC }
原文:https://stackoverflow.com/questions/33074661
最满意答案
在大多数情况下你几乎都是正确的。 为了确保我们用相同的术语,一点点背景说话:
线性回归使用某些结果变量
y
和自变量x1, x2, ..
并尝试找到最佳预测y
的x1, x2, ..
的线性组合。 一旦建立了这种“最佳线性组合”,您就可以通过多种方式评估拟合的质量(即模型的质量)。 您提到的六点都是回归方程质量的关键指标。运行回归可以为您提供多种“成分”。 例如,每次观察都会得到结果变量的预测值 。
y
的观测值与预测值之间的差异称为残差或误差。 残差可以是负数(如果y
被高估)和正数(如果y
被低估)。 残差越接近零越好。 但是,什么是“接近”? 您提供的指标应该提供一个洞察力。
- 平均绝对误差 :取残差的绝对值并取其平均值。
- 均方根误差 :是残差的标准差。 这将有助于您了解残差的差价有多大。 残差是平方的,因此,高残差将计入超过小残差。 低RMSE是好的。
相对绝对误差 :绝对误差作为结果变量
y
的实际值的一部分。 在您的情况下,预测平均比y
的实际值高75%/更低。相对平方误差 :平方误差(
residual^2
)作为实际值的一部分。- 测定系数 :几乎正确。 其范围在0和1之间,可以解释为解释
y
自变量的解释力。 实际上,在您的情况下,自变量可以模拟y
38,15%的变化。 此外,如果您只有一个自变量,则此系数等于平方相关系数。均方根误差和确定系数是几乎所有情况下最重要的指标。 说实话,我从未真正看到其他指标被报道。
You are almost correct on most points. To make sure we are talking in the same terms, a little bit of background:
A linear regression uses data on some outcome variable
y
and independent variablesx1, x2, ..
and tries to find the linear combination ofx1, x2, ..
that best predictsy
. Once this "best linear combination" is established, you can assess the quality of the fit (i.e. quality of the model) in multiple ways. The six points you mention are all key metrics for the quality of a regression equation.Running a regression gives you multiple "ingredients". For example, every observation will get a predicted value for the outcome variable. The difference between the observed value of
y
and the predicted value is called the residual or error. Residuals can be negative (if they
is overestimated) and positive (ify
is underestimated). The closer the residuals are to zero, the better. But, what is "close"? The metrics you present are supposed to give an insight in this.
- Mean absolute error: takes the absolute value of the residuals and takes the mean of that.
- Root Mean Square Error: is the standard deviation of your residuals. This will help you see, how large the spread is of your residuals. The residuals are squared and therefore, high residuals will count in more than small residuals. A low RMSE is good.
Relative Absolute Error: The absolute error as a fraction of the real value of the outcome variable
y
. In your case, the predictions are on average 75% higher/lower than the actual value ofy
.Relative Squared Error: The squared error (
residual^2
) as a fraction of the real value.- Coefficient of Determination: Almost correct. This ranges between 0 and 1 and can be interpreted as the explanatory power of the independent variables in explaining
y
. In fact, in your case the independent variables can model 38,15% of the variation iny
. Also, if you have only one independent variable, this coefficient is equal to the squared correlation coefficient.Root Mean Squared Error and Coefficient of Determination are the most important metrics in nearly all situations. To be honest, I've never really seen the other metrics being reported.
相关问答
更多-
相关性意味着特征与目标之间的线性关系。 如果这两者之间存在某种非线性关系,则可以得到零相关,但该特征仍可以帮助模型。 Correlation implies a linear relationship between the feature and the target. If there is some non-linear relation between these two, it's OK to get a zero correlation but still the feature could h ...
-
这些数据集都不能使用线性分类/回归建模。 在“输入数据转换”的情况下,如果仅数据集是一致的(没有两个完全相同的点具有两个不同的标签), 则始终存在转换,之后数据可线性分离 。 特别是可以用以下方法构建它: phi(x) = 1 iff label of x is "1" 换句话说,您将所有正样本映射到“1”,将负数映射到“0”,因此您的数据现在可以线性分离。 或者简单地将你的N个点映射到R ^ N空间中的N个单位向量,使得我的点被映射到[0 0 0 ... 1 ... 0 0 0] ^ T,其中出现“1” ...
-
机器学习,逻辑回归(machine learning, logistic regression)[2023-01-25]
你的代码中有一些错误。 计算新的theta值时,您需要使用同步更新。 在你改变theta0你改变theta,然后用于theta1计算。 这是错误的。 您可能需要使用两个临时变量(或使用矢量化解决方案)。 成本函数也是不正确的。 它应该由两部分组成: y*log(h)和(1-y)*log(1-h) 。 据我所知,成本函数不能是负数,所以你不需要计算它的绝对值。 正规化对我来说也是错误的。 这是我的代码,它适用于我。 import numpy as np from numpy import * import m ... -
所有你需要的是 x = data[['Col1', 'Col2']] All you need is x = data[['Col1', 'Col2']]
-
你只需要一个小的改变,你想要建模的变量是z而不是y : set.seed(0) x <- runif(1000,-5,5) y <- runif(1000,-2,2) z <- x+y res <- lm(z~x+y) alpha <- 0.01 num_iters <- 10000 theta <- matrix(c(0,0,0), nrow=3) X <- cbind(1, matrix(x), matrix(y)) for (i in 1:num_iters){ cost <- (X%*%thet ...
-
下面是你的问题的补充 - 一些来自KNN和线性回归的方法。 回归技巧 LASSO,岭回归和弹性网是带正则化惩罚的线性回归。 局部线性回归使用局部线性模型(它是线性回归和K最近邻居的组合)构建非线性估计量。 非线性回归技术概括为输入不存在简单线性依赖性的情况,但仍然存在参数模型。 泊松回归将线性回归概括为被估计的数量是一个数的情况(即它不能是负数,并且它总是一个整数) 例如,在A被用来预测B的情况下 ,它被用来预测C。 最小绝对偏差试图使线性回归中的L1范数最小化,而不是L2范数。 各种强大的回归技术试图在异 ...
-
在回归(机器学习)中处理未分配(null)的要素值?(Handling unassigned (null) values of features in regression (machine learning)?)[2022-02-08]
你需要忽略那些行 - 你已经说过你不能这样做,对于缺失值的数量不是一个好主意 - 或者使用主动折扣这些项目的算法,或者推测(这是技术术语用于填写有根据的猜测)缺失的数据。 我们可以提供的帮助是有限的,因为您没有给我们缺少数据所需的语义。 您可以通过对您所拥有的数据使用您最喜欢的“最匹配”算法来计算一些缺失值。 例如,你可以很好地从其他数据中推断出对区域的猜测。 对于您的非线性离散项目(即区域),您可能希望将NULL保留为单独的区域。 如果缺少足够的条目,则无论如何你都可以获得体面的模型。 一个简单的插补是将 ... -
这是因为y与y_形状不同。 y是形状( y_ ), y_是形状(1000)。 所以当你减去它们时,你会无意中创建一个二维矩阵。 要修复它,请将成本函数更改为: cost_function = tf.reduce_mean(tf.square(tf.squeeze(y) - y_)) This is because y is not the same shape as y_. y is of shape (1000, 1) and y_ is of shape (1000). So when you sub ...
-
您可以使用scikit-learn作为您的机器学习库,尤其是其线性回归功能 。 这个例子也许有用。 此外,您始终可以将Weka java API绑定到您的应用程序,或者您自己实现线性回归,在给定矩阵代数库的情况下实现它是相当容易的算法。 You can use scikit-learn as your machine learning library, and particularly its linear regression capability. This example might also be ...
-
在大多数情况下你几乎都是正确的。 为了确保我们用相同的术语,一点点背景说话: 线性回归使用某些结果变量y和自变量x1, x2, ..并尝试找到最佳预测y的x1, x2, ..的线性组合。 一旦建立了这种“最佳线性组合”,您就可以通过多种方式评估拟合的质量(即模型的质量)。 您提到的六点都是回归方程质量的关键指标。 运行回归可以为您提供多种“成分”。 例如,每次观察都会得到结果变量的预测值 。 y的观测值与预测值之间的差异称为残差或误差。 残差可以是负数(如果y被高估)和正数(如果y被低估)。 残差越接近零越 ...