Skip to content

Tmw/linreg

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Linreg

A simple linear regression model built using Elixir and made interactive and visual using Phoenix LiveView. Read the blogposts here

Example

To start

  1. Clone this repo
  2. cd into linreg
  3. Start the Phoenix server: mix phx.server
  4. Play around with it over at http://localhost:4000

Troubleshooting

Clicks not appearing

If you've been following the blogpost and it doesn't appear to register clicks, it is probably due to an update in Phoenix Live View (since 0.13.0) where the metadata of each event is not included by default anymore. To fix this; open up assets/js/app.js and find the line where it says let liveSocket = new LiveSocket(..snip..) and replace it with:

let liveSocket = new LiveSocket("/live", Socket, {
  params: {_csrf_token: csrfToken},
  metadata: {
    click: (e, _el) => {
      return {
        offsetX: e.offsetX,
        offsetY: e.offsetY
      }
    }
  }
})

Thanks to @rinbo for making me aware

License

MIT

About

Linear Regression using Elixir and Phoenix Liveview

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published