user2626234
user2626234

Reputation: 91

Begining to code Logistic regression in java

I want to code the logistic regression(classification problem) algorithm using java -

Hypothesis is -

enter image description here

Can anyone please tell me what −enter image description here(−θ to the power T) is?

I was able to code linear regression its hypothesis is enter image description here which is relatively easy but can not start off with logistic regression.

Upvotes: 0

Views: 1298

Answers (2)

user1481317
user1481317

Reputation:

ΘT is the transpose of parameters vector Θ and ΘTx is the linear combination of input features.If you know linear regression then you can think ΘTx as a output of linear regression. Look at the figure below. enter image description here

The first part is the linear regression. The output of the linear regression is enter image description here. Since logistic regression is not a regression but a classification problem, your output shouldn't be continuous. Instead you require a binary output for any inputs. For this you need a function that maps the range of input to the value between 0 and 1 so that you can apply some threshold to the output to get the classification. And the suitable function for this would be sigmoid function as you mentioned.

Regrading your question, the output of linear regression can be written as
enter image description here

The term = ΘTx is the vectorized implementation of output of linear regression. So ΘT is nothing but a transpose of parameter vector. This can be understood by following mathematical operations. enter image description here

For details in logistic regression and coding check this link.

Upvotes: 3

Lerok
Lerok

Reputation: 11

The ΘT represenets transponse of theta matrix. Where theta matrix is matrix of features. When writing code for those algorthms, I strongly advice yout to use first MATLAB or OCTAVE software first for calculating matrices. Then, when you are sure that your algorithm is working correctly implement it in JAVA.

Cheers, Emil

Upvotes: 0

Related Questions