Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:39:45+00:00 2026-06-18T06:39:45+00:00

I want to use the ad automatic differentiation package for learning neural network weights

  • 0

I want to use the ad automatic differentiation package for learning neural network weights in Haskell. I have found some functions that might just have what I need, however I can’t figure out what they expect as the first parameter. It must be the function to optimize, but I don’t know what form exactly.
They have signatures like this:

gradientDescent :: (Traversable f, Fractional a, Ord a) => (forall s. Mode s => f (AD s a) -> AD s a) -> f a -> [f a]

I have found out forall s. means something named an existential quantifier but nothing more.
My question is, that how could I pass my cost function with a signature like cost :: [Double] -> Double (it takes the list of weights) to this library?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:39:46+00:00Added an answer on June 18, 2026 at 6:39 am

    So the first argument is a function on any traversable of AD to a single AD. For the traversable, we can substitute in something like a list to start with. That function must be polymorphic in mode. So let’s ignore that and just not do something that specifies a mode! This function is obviously the thing we’re optimizing. The next argument is the initial value we pass in. We’ll also call that a list for now. And the result is a list of steadily more optimized choices for improved guesses at our target.

    Note that AD s a is an instance of Num and Fractional for all modes s, as long as a is Num and Fractional. So just write a polymorphic function from a list of integers to a single integer, pass in an initial state, and the function you provided will optimize it for you.

    I.e. don’t specify your cost function as over doubles, but specify it as polymorphic over any Num and Fractional, and let the library take care of the rest!

    You may prefer to get used to this style by trying other, more basic functions such as diff first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want use some data from a website with web service. i have a
We have a powerbuilder application and we want use a scanner through this application
I have a group model which has_many article model. And I want to use
I have a complete automatic notification system running on my web page, that is
I want to use this element to set automatic fields, like audit fields intercepted
I'm new to MyLyn and I really want to use the change sets automatic
Essentially I want to embed some XHTML in an XML document that must validate
I want to use the automatic_tag_name hook to automatic create tag name without the
I use this for loop, which I want to have parallelizide automaticaly, it is
I have a TransactionScope object and I want to use it for all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.