Why we do not use least squares in logit model? I am very wondering why we do not use least squares instead of maximum likelihood?  for example we have 3 choices k= 1, 2 ,3  $minimizing: (e^{\beta_{i} X}/(1+\sum e^{\beta_{i} X})- Y)^{2} $   for i=1,2,3
What is happening here, when I use squared loss in logistic regression setting? I am trying to use squared loss to do binary classification on a toy data set. I am using mtcars data set, use mile per gallon and weight to predict transmission type. The plot below shows the two types of transmission type data in different colors, and decision boundary generated by different loss function. The squared loss is $\sum_i (y_i-p_i)^2$ where $y_i$ is the ground truth label (0 or 1) and $p_i$ is the predicted probability $p_i=\text{Logit}^{-1}(\beta^Tx_i)$. In other words, I am replace logistic loss with squared loss in classification setting, other parts are the same. For a toy example with mtcars data, in many cases, I got a model &quot;similar&quot; to logistic regression (see following figure, with random seed 0).  But in somethings (if we do set.seed(1)), squared loss seems not working well.  What is happening here? The optimization does not converge? Logistic loss is easier to optimize comparing to squared loss? Any help would be appreciated.  Code d=mtcars[,c(&quot;am&quot;,&quot;mpg&quot;,&quot;wt&quot;)] plot(d$mpg,d$wt,col=factor(d$am)) lg_fit=glm(am~.,d, family = binomial()) abline(-lg_fit$coefficients[1]/lg_fit$coefficients[3],        -lg_fit$coefficients[2]/lg_fit$coefficients[3]) grid()  # sq loss lossSqOnBinary&lt;-function(x,y,w){   p=plogis(x %*% w)   return(sum((y-p)^2)) }  # this random seed is important for reproducing the problem set.seed(0)  x0=runif(3) x=as.matrix(cbind(1,d[,2:3])) y=d$am opt=optim(x0, lossSqOnBinary, method=&quot;BFGS&quot;, x=x,y=y)  abline(-opt$par[1]/opt$par[3],        -opt$par[2]/opt$par[3], lty=2) legend(25,5,c(&quot;logisitc loss&quot;,&quot;squared loss&quot;), lty=c(1,2))
When I ssh into my Ubuntu 18.04 box I get the motd  1 update could not be installed automatically   Which goes on to tell me to check the unattended-upgrades log.  The log shows no problems. How can I clear this bogus message? Why has Earth's core not become solid? How to derive addition of velocities without the Lorentz transformation? Apt "Connection failed" Since installing Ubuntu I have been unable to install new packages, it has even failed to update. Below is a dump of connection error I see when I tried to install Wine:  E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/u/unixodbc/odbcinst1debian2_2.3.1-4.1_amd64.deb  Connection failed [IP: 91.189.88.152 80]  E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fonts-wqy-microhei/ttf-wqy-microhei_0.2.0-beta-2_all.deb  Connection failed [IP: 91.189.88.162 80]  E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? PyQGIS couldn't import processing with standalone script I have read post on that problem (). The problem is even with a sys.path.append it couldn't import processing. It's very frustrated. Here the code I used:  #!/usr/bin/python  def main():     layer = QgsVectorLayer('/path/to/file.shp', "BAT","ogr")     QgsMapLayerRegistry.instance().addMapLayers([layer])      # Testing processing     try :         Processing.runalg("qgis:creategrid")     except:         print "Processing module has not been loaded"      #Check the QgsMapLayerRegistry for the layers     print QgsMapLayerRegistry.instance().mapLayers()     # Check if they are valid     print layer.isValid()  if __name__=="__main__":     import sys     from PyQt4.QtGui import *     from qgis.core import *     app = QApplication([])     QgsApplication.setPrefixPath("/usr", True)     QgsApplication.initQgis()      sys.path.append('home/qsuser/.qgis2/python/plugins')      # try to load processing     try:         from processing.core.Processing import Processing         Processing.initialize()      except:         print "unable to load processing"      main()      QgsApplication.exitQgis()   I could load QGIS and layer is valid that's ok, but processing resist to me. I am on Ubuntu 14.04 I use Pycharm to do it.  I tried on terminal with the python console, it raised this error:  Traceback (most recent call last):   File "&lt;stdin&gt;", line 1, in &lt;module&gt;   File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/home/qsuser/.qgis2/python/plugins/processing/__init__.py", line 28, in &lt;module&gt;     from processing.tools.dataobjects import *   File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/home/qsuser/.qgis2/python/plugins/processing/tools/dataobjects.py", line 35, in &lt;module&gt;     from processing.core.ProcessingConfig import ProcessingConfig   File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/home/qsuser/.qgis2/python/plugins/processing/core/ProcessingConfig.py", line 30, in &lt;module&gt;     from PyQt4.QtCore import QPyNullVariant, QCoreApplication, QSettings ImportError: cannot import name QPyNullVariant   I don't know what I am missing.   Settings :  Qgis 2.12.1-Lyon Ubuntu 14.04 Trusty IDE : Pycharm 5 community Processing : 2.12.2   -- Edit -- And with the changes suggest by mathias kuhn  #!/usr/bin/python  def main():     layer = QgsVectorLayer('/path/to/file.shp', "BAT","ogr")     QgsMapLayerRegistry.instance().addMapLayers([layer])      # Testing processing     try :         Processing.runalg("qgis:creategrid")     except:         print "Processing module has not been loaded"      #Check the QgsMapLayerRegistry for the layers     print QgsMapLayerRegistry.instance().mapLayers()     # Check if they are valid     print layer.isValid()  if __name__=="__main__":     import sys     from qgis.core import *             from PyQt4.QtGui import *     app = QApplication([])     QgsApplication.setPrefixPath("/usr", True)     QgsApplication.initQgis()      sys.path.append('home/user/.qgis2/python/plugins')      # try to load processing     try:         from processing.core.Processing import Processing         Processing.initialize()      except:         print "unable to load processing"      main()      QgsApplication.exitQgis() How many questions on meta have asked, "Why can't I ask this question when that question is open"? Read a file backwards line by line using fseek Question on showing a bijection between $\pi_1(X,x_0)$ and $[S^1, X]$ when X is path connected. I am trying to do this question taken from Hatchers algebraic topology and I am struggling to understand the notation and the concepts.  As far as I know $\pi_1(X,x_0)$ is the set of end point preserving homotopy classes of loops in X based at $x_0$ and a loop is just a path    $f:I \rightarrow X$ with $f(0)=f(1)$. The question says we can regard $\pi_1(X, x_0)$ as the set of basepoint preserving homotopy classes of maps $(S^1, s_0) \rightarrow (X, x_0)$.   This confuses me, does it mean the set of basepoint preserving homotopy class on maps $g:S^1 \rightarrow X$ which map loops in $S^1$ based at $s_0$ to loops in X based at $x_0$?  Then how can $\pi_1(X,x_0)$ be regarded as this set?  If someone could explain this it would be really useful Explicitly finding the sum of $\arctan(1/(n^2+n+1))$ This is from a GRE prep book, so I know the solution and process but I thought it was an interesting question: Explicitly evaluate $$\sum_{n=1}^{m}\arctan\left({\frac{1}{{n^2+n+1}}}\right).$$ Case insensitive searching in Oracle Exception messages in English? Does one need to adjust for multiple comparisons when using MANOVA? There are 10 dependent variables and 2 groups. When I wanted to compare 10 dependent variables between two groups, I performed MANOVA.  I wonder if there is a multiple comparison problem in that case. Should I have performed Bonferroni correction because of 10 dependent variables? Or is Bonferroni useless because MANOVA just does analysis once? Finding the limit $\lim \limits_{n \to \infty}\ (\cos \frac x 2 \cdot\cos \frac x 4\cdot \cos \frac x 8\cdots \cos \frac x {2^n}) $ Not able to add 3 JPanels to a main panel Resources for Blender Since asking for tutorials, videos, resources, links to other content or downloads is considered off topic here, this is a specifically created Community Wiki which gathers resources for Blender and it has been approved by the .  Just write in the appropriate answer/section. If you have concerns, questions, post a  question, so we don't clutter the comments, but you can link your meta question from the comments.  Questions regarding such resources are not allowed anymore, except for very specific and on topic requests (ask on  if you're unsure about your question). Follow the instructions made in the question about how to post, what can be posted, etc.  Learning             Assets    (also see: )   Reference Images/Blueprints (also see: )    Tools    (also see: )      Other   Special Interest ()     Also see the . "Above"/"below" before/after a noun How can I tell how long (more or less) it will take me to complete a game? Possible Duplicate:          I often want to know how long a game is so that I can decide whether or not to buy it, or even to decide if I've got enough free time available in the near-future to make it worth trying to play and complete over a weekend. Sometimes I even want to know just because I'm getting a little tired of the game and I want to have a sense of whether or not I'm nearing the end, so I can decide whether to tough it out or pack it in.  What are some good ways of determining how long a given game takes to complete, on average? How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program? Why is the triangle inequality property important for metric spaces? There is a property in the axiomatization of metric space: $d(x,z)\le d(x,y)+d(y,z)$. I understand that property applies well when it come to the measure of distances among points. However, that property seems to be irrelevant in the definitions of continuity, open set and some other key concepts.  My topology book says that it is asserting "the transitivity of closeness", a vague term that loses me. So why is that property important? Why did the founders (if any) of topology consider it at the first place? And what if that property is missed? What would happen if two wizards made each other a Horcrux? Would they be invincible? How would you kill one of them?