Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.

Sign Up

Articles related to "hook"

A Visual Guide to React Mental Models: UseState, UseEffect and Lifecycles

  • My mental model when working with useState is this: since state is not affected by what happens to the box, I imagine it as a constant value within it.
  • What’s interesting is that each component still has a lifecycle: its mounted, rendered and unmounted, and each step must be taken into account for a fully-functional mental model around React components.
  • My mental model for mounting is this: whenever a parent box decides a child must be created, it mounts it, then the component will do three things: assign default values to useState, run its logic, render, and execute the useEffect hook.
  • To summarize so far: a component is just a function, props are the function’s arguments and state is a special value that React makes sure to keep consistent across renders.

save | comments | report | share on

Quickly label data in Jupyter Lab

  • For a NLP project we needed a tool for labeling short text into one or more categories.
  • It was plain simple: in Jupyter you feed a list of text and a list of labels to a function and a widget pops up to walk through each example.
  • Additionally, custom hooks can be attached to each row update (example_process_fn), or when the annotating task is complete(final_process_fn).
  • While the custom hooks might again add to much complexity, here is an example for a use-case.
  • When having a DataFrame of 1000 examples to label, it might be to much to do in one go.
  • As an example for a row-based hook-function, we change the labels to their numerical equivalents and update the DataFrame with each row.
  • There are many useful tools for labeling data.
  • Pigeon was already a great tool but we had to add some functionality for our needs.

save | comments | report | share on