ml5-library icon indicating copy to clipboard operation
ml5-library copied to clipboard

Need some information on using NeuralNetworkVis

Open devihall opened this issue 1 year ago • 4 comments

→ 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...

  • Web browser & version:
  • Google Chrome
  • Operating System:
  • MacBook Pro Apple M1
  • Mac OS 14.4 (23E214)
  • ml5 version -latest:

devihall avatar Apr 11 '24 16:04 devihall

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

devihall avatar Apr 23 '24 18:04 devihall

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 avatar May 03 '24 19:05 shiffman

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

devihall avatar May 06 '24 15:05 devihall

@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.

shiffman avatar May 07 '24 17:05 shiffman