[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/prog/ - Programming

Programming board

Catalog

Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


File: 1457891881754.jpg (11.89 KB, 189x267, 63:89, grey fox.jpg)

ebad9d No.4013

HURT ME MORE SNAKE, MAKE ME FEEL ALIVE AGAIN!



import numpy

"""training data"""
x = numpy.array([[1,1,1,0,0,0],
[1,0,1,0,0,0],
[1,1,1,0,0,0],
[0,0,1,1,1,0],
[0,0,1,1,0,0],
[0,0,1,1,1,0]])

correct_label = numpy.array([[1, 0],
[1, 0],
[1, 0],
[0, 1],
[0, 1],
[0, 1]])

"""initializes weight and bias as zero vectors"""
weight = numpy.zeros((6, 2))
bias = numpy.zeros((6, 2))

def softmax(a_vector):
"""Compute a logit for a vector."""
denom = sum(numpy.exp(a_vector))
logit = numpy.exp(a_vector)/denom
return logit

def softmax_a_set(a_set):
"""computes logits for all vectors in a set"""
softmax_set = numpy.zeros(y.shape)

for x in numpy.nditer(a_set):
x = softmax(x)

return softmax_set

def cross_entropy(logit, label):
"""generates the cross entropy between label and logit"""
return -1*sum(numpy.log(logit)*label)

def train(x):
"""walks the function closer to the best value"""
pass

y = numpy.dot(x,weight) + bias

6dcd5d No.4034

what is this shit?


4a0d42 No.4035

>>4034

someone who's seen docstrings but doesn't know how they work.

also looks like neural network stuff.




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]