question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Private Functions in NeuralNetwork

See original GitHub issue

So I have been thinking about https://github.com/BrainJS/brain.js/issues/99 and I think another thing that can get new users bogged down is how many methods and variables are exposed. For example in the REPL I instantiate a simple NeuralNetwork and her are the things I have control over:

image

How many of these do we actually want the user to be interacting with? If the user trains a network, then randomly calls initialize with some given size their network is dust in the wind.

I think if we take the methods that are meant to only be used internally within the class and declare them in the constructor (or some other scheme for having them not public). I think that might also help those new to the library. I don’t mind doing this If you want me to.

Just check boxes you want Private and I will take care of it.

  • adjustWeights
  • calculateDeltasLeakyRelu
  • calculateDeltasRelu
  • calculateDeltasSigmoid
  • calculateDeltasTanh
  • createTrainStream
  • formatData
  • fromJSON
  • initialize
  • run
  • runInputLeakyRelu
  • runInputRelu
  • runInputSigmoid
  • runInputTanh
  • setActivation
  • test
  • toFunction
  • toJSON
  • train
  • trainPattern
  • activation
  • biases
  • binaryThresh
  • calculateDeltas
  • changes
  • deltas
  • errors
  • hiddenLayers
  • hiddenSizes
  • learningRate
  • momentum
  • outputLayer
  • outputs
  • runInput
  • sizes

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
freddyCcommented, Jan 18, 2018

So I was talking to @robertleeplummerjr about this a bit. The main thing I think would help new users is a more clear interface on which methods are meant for them to interact with. At the same time, I think for those looking through the code it would be more clear to have smaller functions in the neural-network itself, so it is easier to read and understand.

How about adding _ before methods that are meant to be private?

This would let us break out private functions into smaller and easier to read methods, without confusing those starting with the library, since the publicly intended functions are a bit more explicit.

Thoughts?

0reactions
freddyCcommented, Jan 30, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Private Collaborative Neural Network Learning
To provide a solution to the problem of private collaborative neural network learning, we combine several technologies including MPC, DP, and secret sharing. ......
Read more >
Private and Reliable Neural Network Inference
Reliable neural networks (NNs) provide important inference-time reliability guarantees such as fairness and robustness. Comple- mentarily, privacy-preserving ...
Read more >
SecureNN: Efficient and Private Neural Network Training
Neural Networks (NN) provide a powerful method for machine learning training and pre- diction. ... and the output prediction, private from other parties....
Read more >
Neural Network Tutorial - Ch. 3 Private variables - YouTube
In this chapter we will define all necessary private variables for the network.
Read more >
Differentially Private Self-normalizing Neural Networks For ...
Differential Privacy involves the addition of random noise to a data sample to produce anonymity.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found