首页 \ 问答 \ 如何在点击li标签内的锚标签时激活特定的Li标签?(How to make particular Li tag active on click on anchor tag inside of that li tag?)

如何在点击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
更新时间:2022-04-28 22:04

最满意答案

在大多数情况下你几乎都是正确的。 为了确保我们用相同的术语,一点点背景说话:

线性回归使用某些结果变量y和自变量x1, x2, ..并尝试找到最佳预测yx1, 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 variables x1, x2, .. and tries to find the linear combination of x1, x2, .. that best predicts y. 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 the y is overestimated) and positive (if y 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 of y.

  • 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 in y. 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” ...
  • 你的代码中有一些错误。 计算新的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保留为单独的区域。 如果缺少足够的条目,则无论如何你都可以获得体面的模型。 一个简单的插补是将 ...
  • 这是因为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被低估)。 残差越接近零越 ...

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)