Hello, i am new to julia.
-- I am trying to implement logistic regression as per some course on Machine learning. I am using the Atom editor for running Julia. However i am unable to find the right arguments for using the optimize function. I am sending my differentiable function which is the costFunction and initial_theta as the initial parameters. What other arguments are needed? Which optimizer function should be used? I am attaching my code here. This is my cost function: "This function calculates the cost and gradient at a given theta" function costFunction( initial_theta,X, y) m = length(y); J = 0; grad = zeros(size(initial_theta)); z = X * initial_theta; h_theta = sigmoid(z); J = (-1/m) * ( y .* log(h_theta) + (1-y) .* log(1 - h_theta) ); grad = (1/m) * X' * ( h_theta - y ); return J, grad; end This is the snippet from my main function: l() = Optim.DifferentiableFunction( methodToUse = Optim.GradientDescent() options = Optim.OptimizationOptions( optimize(l,initial_theta) ######### when i do this, i get a stack over flow error optimize(l,initial_theta, methodToUse,options) ######## with this i get a Method error : no method matching finite_difference Let me know if any additional information is needed. Thanks! You received this message because you are subscribed to the Google Groups "julia-opt" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. Visit this group at https://groups.google.com/group/julia-opt. For more options, visit https://groups.google.com/d/optout. |
First off, can you explain your thoughts behind "I() = ..." ? You are defining a function that takes no arguments and returns a DifferentiableFunction type instance. You should just write "df = Optim.DifferentiableFunction(costFunction(initial_theta,X,y))" and then pass "df" instead of "I".
-- On Monday, October 24, 2016 at 9:07:46 AM UTC+2, SajeelBongale wrote:
You received this message because you are subscribed to the Google Groups "julia-opt" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. Visit this group at https://groups.google.com/group/julia-opt. For more options, visit https://groups.google.com/d/optout. |
Hello Patrick,
-- Thank you for your suggestion. I tried what you have mentioned above. When I do this, df = Optim.DifferentiableFunction( it throws this error MethodError: Cannot `convert` an object of type Array{Float64,2} to an object of type Optim.DifferentiableFunction On Monday, October 24, 2016 at 1:50:35 PM UTC+5:30, Patrick Kofod Mogensen wrote:
You received this message because you are subscribed to the Google Groups "julia-opt" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. Visit this group at https://groups.google.com/group/julia-opt. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |