ml5js / ml5-library

Friendly machine learning for the web! πŸ€–
https://ml5js.org
Other
6.37k stars 907 forks source link

Need some information on using NeuralNetworkVis #1484

Open devihall opened 1 month ago

devihall commented 1 month ago

β†’ Issue Description πŸ“

Need some information on using NeuralNetworkVis I see from the documentation that using debug:true provides a visor with loss graph and model summary by default. However I'm trying to get some other visualizations such as Confusion Matrix, and Accuracy graph for training data and validation data.

I noticed on the Github repo Confusion Matrix is commented out.

Is this not available yet?

Also do I need to initialize this property like I have done here?

const nn = ml5.neuralNetwork(options);
const vis = nn.neuralNetworkVis;

β†’ Step 2: Screenshots or Relevant Documentation πŸ–Ό

Here's a screenshots of the commented code on the ml5 repo :

Screenshot 2024-04-11 at 12 47 25β€―PM

β†’ Step 3: Share an example of the issue πŸ¦„

Here's an example of my code implementation:

I'm trying to append the graphs to the DOM instead of using a visor and this is how I'm implementing this functionality.

Is this an appropriate way to achieve this?

function whileTraining(epoch, loss) {

console.log("Loss obj only:", loss);
console.log(`Epoch ${epoch}, Loss: ${loss.loss}`);

//   Accumulate loss data
  trainingLossData.push({ x: epoch, y: loss.loss });
    validationLossData.push({ x: epoch, y: loss.val_loss});

  // Visualize the accumulated loss data
  const trainingLossGraph = {
    values: trainingLossData,
    series: ["Training Loss/Validation Loss vs Epoch"],
  };

  const validationLossGraph = {
    values: trainingLossData,
    series: ["Training Loss vs Epoch"],
  };

  const container = document.getElementById("loss-chart");
  const options = {
    xLabel: "Epoch",
    yLabel: "Loss",
  };
  tfvis.render.linechart(container, trainingLossGraph, options);
}

Other relevant information, if applicable

β†’ Describe your setup πŸ¦„

Here's some helpful information about my setup...

devihall commented 3 weeks ago

Hey ml5 team! Just wondering if yall had a chance to look into this. Thanks so much for all your fantastic work on this library. @bomanimc @shiffman

shiffman commented 2 weeks ago

Hi @devihall, my apologies! We're working to archive/deprecate this repo, the work of ml5.js is continuing in ml5-next-gen. The ml5.js library only provides a very basic defualt behavior for the tf.js visor, to expand the capabilities you likely need to work with tensorflow.js directly? We have a discord if you want to join and ask questions there! https://discord.gg/32X2smhx

devihall commented 1 week ago

Hi @devihall, my apologies! We're working to archive/deprecate this repo, the work of ml5.js is continuing in ml5-next-gen. The ml5.js library only provides a very basic defualt behavior for the tf.js visor, to expand the capabilities you likely need to work with tensorflow.js directly? We have a discord if you want to join and ask questions there! https://discord.gg/32X2smhx

@shiffman Thanks for your response! What happens to our app one this repo gets deprecated? we are using ml5 extensively

shiffman commented 1 week ago

@shiffman Thanks for your response! What happens to our app one this repo gets deprecated? we are using ml5 extensively

This repo will remain online as well as all the existing and previous versions of ml5.js! Just make sure you are tagging a specific version of ml5 in your project rather than just @latest.

The goal for the updated ml5.js "next generation" is to include any and all of the important and useful features of current ml5.js. What features and functions are you currently using for your work?

The one we have yet to re-implement is the "feature classifier" but that should be coming soon.