I am working on a problem regarding authorship-attribution. Our multilabel (three possible authors) data set is highly imbalanced. We already took steps to solve the class-imbalance problem (by sampling our learning set ). Now we want to measure if our approach actually improves the performance regarding the class imbalance problem. We already did extensive cross validation but are struggling with the metrics. What kind of metrics would be appropriate for this task? We are currently using sklearn. Our results show that the underrepresented classes are being detected more often, after sampling the learning set, but some of those results are actually false positives that were attributed to the large class correctly before. The classification was tending towards the other end before where the large class was often selected inacrately. Is there any metric that can be used to balance both error rates? We want to optimize towards a classification that detects one of the smaller classes correctly most of the time but does not produce false positives.
For a multiclass imbalanced problem, accuracy is not a good metric to evaluate model performance. Equally, accuracy is a global metric, so nothing like accuracy per-class (doesn't make sense). Scikit-learn provides the classification_report  function so one can evaluate model's precision/recall per class, e.g: classification_report(y_true, y_pred, target_names=target_names)               precision    recall  f1-score   support       Class:0      0.703     0.896     0.788      4491      Class:1      0.048     0.147     0.072        75      Class:2      0.368     0.503     0.425      1097      Class:3      0.937     0.850     0.892     17162      Class:4      0.529     0.177     0.265       311      accuracy                          0.832     23136    macro avg      0.517     0.515     0.488     23136 weighted avg      0.856     0.832     0.838     23136  Are there other metrics that evaluate per-class so I can evaluate my model across more metrics than precision/recall/f1? The goal is to assess the model on a per-class basis.
Is there a general formula for finding the primitive of $$e^{ax}\sin(bx)?$$  I've done this manually with $a=9$ and $b=4$ using Euler's formulas. But it takes a bit of time. Is there a pattern here? Sort thebibliography by citation order Is the cube root of a prime number rational? The question is: if $P$ is prime, is $P^{1/3}$ rational?   I have been able to prove that if $P$ is prime then the square root of $P$ isn't rational (by contradiction) how would I go about the cube root? Why do my lamps require an insane "strength" value of 1 million? Getting filesystem path of class being executed Should a toggle button show its current state or the state to which it will change? How to capture the scene exactly as my eyes can see? Take any three random variables $X_1$, $X_2$, and $X_3$.   Is it possible for $X_1$ and $X_2$ to be dependent, $X_2$ and $X_3$ to be dependent, but $X_1$ and $X_3$ to be independent?  Is it possible for $X_1$ and $X_2$ to be independent, $X_2$ and $X_3$ to be independent, but $X_1$ and $X_3$ to be dependent? Co-signed a loan and I need to have my name removed How can I include a YAML file inside another? So I have two YAML files, "A" and "B" and I want the contents of A to be inserted inside B, either spliced into the existing data structure, like an array, or as a child of an element, like the value for a certain hash key.  Is this possible at all? How? If not, any pointers to a normative reference? why normalize and the definition of directional derivative I'm not understanding how to solve this problem.  I think the problem lies in the fact that I don't understand why normalize and the definition of directional derivative... It's in Portuguese. The question would be: Determine the directional derivative of f in P in direction of vector u: Differences between hash- and encryption algorithms? There is a lot of confusion between hash- and encryption algorithms; I would like to understand:   When do we use a hash algorithm and when do we use an encryption algorithm (a cipher)? How difficult it is to reverse hash- and encryption algorithms? From the theoretical/mathematical perspective, what differentiates a hash- and encryption algorithm? Vote too old to be changed, unless post is edited Anyone seen this one yet? Vote too old to be changed, unless post is edited My vote was only a few hours old. Then I realized the answer was wrong. Updated my question and went to remove the vote. Even after updating question I still have the issue. Small issue, but frustrating.  See also: How can I prove the IFF condition for this group of matrices? I'm tasked with showing that matrix $A$ commutes with every $2\times2$ matrix if and only if $A = \begin{bmatrix}a &amp; 0\\0 &amp; a\end{bmatrix}$ for some a.  I was able to prove in the first direction, assuming that $A = \begin{bmatrix}a &amp; 0\\0 &amp; a\end{bmatrix}$, by just multiplying the matrix by $\begin{bmatrix}a &amp; b\\c &amp; d\end{bmatrix}$ in AB = BA format, and showing how AB does equal BA.  $$ (=&gt;)$$  $$\begin{bmatrix}a &amp; 0\\0 &amp; a\end{bmatrix}\begin{bmatrix}a &amp; b\\c &amp; d\end{bmatrix} = \begin{bmatrix}a &amp; b\\c &amp; d\end{bmatrix}\begin{bmatrix}a &amp; 0\\0 &amp; a\end{bmatrix}$$  $$\begin{bmatrix}a^2 &amp; ab\\ac &amp; ad\end{bmatrix} = \begin{bmatrix}a^2 &amp; ab\\ac &amp; ad\end{bmatrix}$$  But now I have to prove in the other direction, assuming that A already does commute with every $2\times 2$ matrix, and I'm not particularly sure how I can do that. Somehow, I have to show that if A commutes with $\begin{bmatrix}a &amp; b\\c &amp; d\end{bmatrix}$, then A will be $\begin{bmatrix}a &amp; 0\\0 &amp; a\end{bmatrix}$, and I don't know how I can carry that out.   Where can I start? Ideas are appreciated. I am trying to prove a result, for which I have got one part, but I am not able to get the converse part.  Theorem. Let $R$ be a commutative ring with $1$. Then $f(X)=a_{0}+a_{1}X+a_{2}X^{2} + \cdots + a_{n}X^{n}$ is a unit in $R[X]$ if and only if $a_{0}$ is a unit in $R$ and $a_{1},a_{2},\dots,a_{n}$ are all nilpotent in $R$.  Proof. Suppose $f(X)=a_{0}+a_{1}X+\cdots +a_{n}X^{n}$ is such that $a_{0}$ is a unit in $R$ and $a_{1},a_{2}, \dots,a_{r}$ are all nilpotent in $R$. Since $R$ is commutative, we get that $a_{1}X,a_{2}X^{2},\cdots,a_{n}X^{n}$ are all nilpotent and hence also their sum is nilpotent. Let $z = \sum a_{i}X^{i}$ then $a_{0}^{-1}z$ is nilpotent and so $1+a_{0}^{-1}z$ is a unit. Thus $f(X)=a_{0}+z=a_{0} \cdot (1+a_{0}^{-1}z)$ is a unit since product of two units in $R[X]$ is a unit.   I have not been able to get the converse part and would like to see the proof for the converse part. heat weighting: failed to find solution for one or more bones Here is the .  Picture:   It's nothing special but I cant figure out why I get problems rigging this mesh. It would be important and a great Help! Thanks for reading and I know there are a lot of guides answering this question but I tried all and it doesn't seem to work. Test if there are files matching a pattern in order to execute a script I am trying to write an if statement to test whether there are any files matching a certain pattern. If there is a text file in a directory it should run a given script.  My code currently:  if [ -f /*.txt ]; then ./script fi   Please give some ideas; I only want to run the script if there is a .txt in the directory. I noticed that sometimes my code gets highlighted in different colors when rendered.   What is syntax highlighting? How does it work? Why isn't my code being highlighted correctly? How do I report a bug or request a new language? How do I use syntax highlighting? What languages are currently available on Stack Exchange? Let $C[0,1]$ denote the ring of continuous functions on $[0,1]$. Consider the maximal ideal $M_a =\{ f\in C[0,1] | f(a)=0 \}$ for $a$ $\in$ $[0,1]$. Is $M_a$ finitely generated?   Note: It may seem that $M_a = \langle x-a\rangle$ which is certainly not true because $ \vert x-a \vert $ is in $M_a$ but not in $\langle x-a\rangle$. Any ideas for solving this question? Let $G$, $H$, and $K$ be abelian groups. Assume $G \oplus H \cong G \oplus K$. If each are finitely generated, then the structure theorem easily gives us that $H \cong K$. However, there are counterexamples in the general case, namely $H=\mathbb{Z}$, $K=\mathbb{Z} \oplus \mathbb{Z}$, and $G=\bigoplus_{i=1}^\infty\mathbb{Z}$.   I am wondering what goes wrong with the following argument:   Form the split short exact sequence  $$0 \to G \xrightarrow{i} G \oplus H \xrightarrow{\pi} H \to 0$$  where $i$ and $\pi$ are the inclusion and projection, respectively. Then don't we immediately get from the first isomorphism theorem that $H \cong (G \oplus H)/G$, which would contradict the counterexample above?   If we run this for the counterexample given, we get the sequence   $$0 \to \bigoplus_{i=1}^\infty\mathbb{Z} \to \bigoplus_{i=1}^\infty\mathbb{Z} \to \mathbb{Z} \to 0$$  which seems to still be short exact, even though here $G \cong G \oplus H$. But of course here we can see directly that $(G \oplus H)/G \cong G/G$, which is trivial. So what went wrong?   It seems to me to be something along these lines: In this case, the kernel of the projection is not the same as the original group, it is just, say, $0 \oplus \mathbb{Z} \oplus \mathbb{Z} \oplus \dots$, i.e. nontrivial from the second coordinate on, which just happens to be isomorphic to the original group. So if we form the other short exact sequence with $K$ in place of $H$, then the difference seems to be that we have two different projection maps with different (but isomorphic) kernels.   But I'm not really sure how to explain this in the general case, if my reasoning is correct to begin with.   Thanks in advance for any help!