The origin of logistic regression is actually logistic curve which varies from the value 0 to the value 1. It looks like the letter S, and it specifies the growth of species.  If our data distribution is in the form S, we can use this logistic curve to represent our data (regression).  However, logistic curve can also be used in classification. Since it takes the values between zero and one, it is usable in also classification.  My confusion starts in this point. Why do we use different loss(cost) functions in logistic regression and logistic regression classification ?  $Loss = L(w) = \sum_{n=1}^N (\sigma(x_n^\top w + b) - y_n)^2$  $Loss = L(w) = \sum_{n=1}^N -y_n\log(\sigma(x_n^\top w + b))- (1-y_n)\log(1 - \sigma(x_n^\top w + b))$  The first loss function specified above is used for logistic regression. The second one is for logistic regression classification.   Actually, In both problems, we tune logistic curve perfectly to minimize loss function. Hence, we can use first loss function, in which least square is used, for also classification problem.  I tried to justify this idea, and I took a reply from someone. In the reply, the following explanation is written:  First loss function is not used for classification, since first loss function depends on least square technique. Least square technique is used to minimize distance between ground truth and predicted labels. Minimizing this distance enables us to represent our data perfectly, which refers to regression. However, we do not want to perform regression. We want to perform classification. For classification, loss function must be more sharp, which means that it must make the mistake more noticeable. Hence, logarithm is used in loss function of logistic regression classification.   What do you think about this explanation. Is it true ? Is there any other perspective which explains why we do not use first loss function in logistic regression classification ?
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))
Changing data type in ArcGIS attribute table? Managing Metered Connections on OSX Calculate Limit 0f nested square roots Sync +- 70 000 records from CSV into drupal I have a CSV file with approx. 70.000 records that I want to import into Drupal 7. Once this is done the client will provide a new CSV file on a daily base that has to sync the updated rows to Drupal.   I wrote a import with  and the  module, but in both cases it takes like forever to import the 70.000 rows. Is there any other solution to import the data faster in Drupal 7? What is the best way to remove accents (normalize) in a Python unicode string? The  that is defined as $Y_{t} = Y_{t-1} + e_t$, where $e_t$ is white noise. Denotes that the current position is the sum of the previous position + an unpredicted term. You can prove that the mean function $\mu_t = 0 $, since $$E(Y_{t}) = E(e_1+ e_2+ ... +e_t) = E(e_1) + E(e_2) +... +E(e_t) = 0 + 0 + \cdots + 0$$ But why is it that the variance increases linearly with time? Does this have something to do with it's not “pure” random, since the new position is very correlated with the previous one? EDIT: Now I have a much better understanding by visualizing a big sample of random walks, and here we can easily observe that the overall variance does increase over time,  and the mean is as expected around zero. Maybe this was trivial after all, since in the very early stages of the time series (compare time = 10 with time = 100) the random walkers have not had yet the time to explore as much. Is storing passwords hashed with the email more secure than without? I was so excited about the Spring '14  as a way to present data visualizations on a public site, and now it looks like that's not possible.  I created a page that looks basically like the release notes sample:  &lt;apex:page &gt;     &lt;analytics:reportChart reportId="00OW0000000Spru"&gt;&lt;/analytics:reportChart&gt; &lt;/apex:page&gt;   I tested it inside the authenticated environment, where it works fine, then added it to a Site. There, I get the error: To view the report chart, you need both the Run Reports permission and access to the report's folder. But, Run Reports is not a permission I can grant to the Site Guest User.  Anybody have any ideas for a workaround? Or is it not going to be possible to show report charts on a public site? I have a log file being written by another process which I want to watch for changes. Each time a change occurs I'd like to read the new data in to do some processing on it.  What's the best way to do this? I was hoping there'd be some sort of hook from the PyWin32 library. I've found the win32file.FindNextChangeNotification function but have no idea how to ask it to watch a specific file.  If anyone's done anything like this I'd be really grateful to hear how...  [Edit] I should have mentioned that I was after a solution that doesn't require polling.  [Edit] Curses! It seems this doesn't work over a mapped network drive. I'm guessing windows doesn't 'hear' any updates to the file the way it does on a local disk. Circular polarizing filter - slim or regular? I have a Canon EOS 550D. Right now I only have some standard lenses, and I'm looking to buy a Tokina AT-X 116 Pro DX II 11-16mm F/2.8. (I love landscape photography and photography in nature in general.) I want to try using a circular polarizing filter, and I've been looking at the Hoya Filter Circ Pol DMC Pro1 77mm. I can see that the "slim" version is cheaper than the regular one, however, I'm not sure what the difference is. Can any of you tell me which would one be preferable for landscape photography? (I found a thread posted about this some years ago but I would like to hear what you guys think, knowing what camera, lens and filter I'm thinking about combining.)  All feedback would be very much appreciated! :-) Then what is the probability that out of $n$ men $A_1,A_2,....,A_n$ each aged $x$ years,$A_1$ will die and will be the first to die Let $p$ be the probability that a man aged $x$ years will die in a year time.Then what is the probability that out of $n$ men $A_1,A_2,....,A_n$ each aged $x$ years,$A_1$ will die and will be the first to die?  The probability that a man aged $x$ years will die in a year time$=p$  The probability that a man aged $x$ years will not die in a year time$=1-p$  But from here on,i got stuck.Some hints and suggestions are welcome. No sound ALC294 Asus ROG Strix 512 Ubuntu 20.04.01 Calculate the radius of a circle given the chord length and height of a segment I have a (circular) segment of known height and known chord length. Is is possible to determine the radius of the circle?  Any help much appreciated. I'm using MySQL's AUTO_INCREMENT field and InnoDB to support transactions. I noticed when I rollback the transaction, the AUTO_INCREMENT field is not rollbacked? I found out that it was designed this way but are there any workarounds to this? If the plural of ‘man’ is ‘men,’ shouldn’t the plural of ‘German’ be ‘Germen’? What makes these two words so different that 'man' is changed to 'men', but 'German' is changed to 'Germans'? Let's consider two statements: Zorn's lemma and theorem about existence of maximal ideals in commutative ring with $1$.  It's easy to prove that Zorn's lemma implies existence of maximal ideals.  I wonder if the converse proposition is true, i. e., does existence of maximal ideals implies Zorn's lemma? My approach was to construct a ring structure on an ordered set which satisfies Zorn's lemma condition such that existence of maximal ideal implies existence of maximal element in the set, but I didn't succeed. Missing $ inserted The number of different ways to choose $k$ out of $n$ unique items The number of different ways to choose $k$ out of $n$ unique items:   Without repetition and without order-significance: $\binom{n}{k}=\frac{n!}{k!(n-k)!}$ Without repetition and with order-significance: $\binom{n}{k}\times k!=\frac{n!}{(n-k)!}$ With repetition and with order-significance: $n^k$ With repetition and without order-significance: $?$   Thank you! IBM Slack links broken Does anyone know where I can find working Slack invite links to any of IBM's Slack pages? The Slack links on  are all broken. Thank you. I have a Java process that opens a file using a FileReader. How can I prevent another (Java) process from opening this file, or at least notify that second process that the file is already opened? Does this automatically make the second process get an exception if the file is open (which solves my problem) or do I have to explicitly open it in the first process with some sort of flag or argument? To clarify: I have a Java app that lists a folder and opens each file in the listing for processing it. It processes each file after the other. The processing of each file consists of reading it and doing some calculations based on the contents and it takes about 2 minutes. I also have another Java app that does the same thing but instead writes on the file. What I want is to be able to run these apps at the same time so the scenario goes like this. ReadApp lists the folder and finds files A, B, C. It opens file A and starts the reading. WriteApp lists the folder and finds files A, B, C. It opens file A, sees that is is open (by an exception or whatever way) and goes to file B. ReadApp finishes file A and continues to B. It sees that it is open and continues to C. It is crucial that WriteApp doesn't write while ReadApp is reading the same file or vice versa. They are different processes.