Skip to content

Instantly share code, notes, and snippets.

View ronnathaniel's full-sized avatar
🐳

Ron Nathaniel ronnathaniel

🐳
View GitHub Profile
@ronnathaniel
ronnathaniel / perceptron_with_pytorch.py
Created May 13, 2023 22:57
A Perceptron (Neural Network system consisting of only one neuron).
# Perceptron Diagram: https://datascientest.com/en/wp-content/uploads/sites/9/2021/03/perceptron-formule.png
# 1 Neuron: 1 inputs -> 1 output
# Perceptron will be trained to learn XOR boolean operation.
# Input will be given as Vectors of length 2 in binary,
# and Output is expected as a XOR of the Input.
# What started out as a perceptron was randomly given a hidden layer, just for fun.
# Showcases the different combinations or strategies possible for Architecture.
# PyTorch and NumPy used for the model.
# Ron Nathaniel
@ronnathaniel
ronnathaniel / perceptron_no_third_party_modules.py
Last active May 13, 2023 22:57
A Perceptron (Neural Network system consisting of only one neuron).
# Perceptron Diagram: https://datascientest.com/en/wp-content/uploads/sites/9/2021/03/perceptron-formule.png
# 1 Neuron: 1 inputs -> 1 output
# Perceptron will be trained to scale numbers by a factor.
# Input will be given as integers, and Output is expected as a scaling (in this case 2x) of the Input.
# Perceptron should produce 2x the given input.
# No Third Party modules have been used.
# Ron Nathaniel
class Perceptron:
@ronnathaniel
ronnathaniel / http_serve_epsagon.go
Created October 26, 2020 16:58
Epsagon Wrapper for net/http Server in Golang
type handler struct {
config *epsagon.Config
}
func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
epsagon.GoWrapper(h.config, epsagonHandler) (w, r)
}
func epsagonHandler(w http.ResponseWriter, r *http.Request) {
@ronnathaniel
ronnathaniel / gin_serve_epsagon.go
Created October 26, 2020 16:55
Epsagon Wrapper for Gin framework in Golang
func post (c *gin.Context) {
epsagon_config := newEpsagonConfig()
epsagon.GoWrapper(epsagon_config, postEpsagon) (c)
}
func postEpsagon (c *gin.Context) {
c.JSON(200, gin.H {
"message": "pong back from Epsagon",
"name": c.Param("name"),
})