MESSAGE
DATE | 2017-03-29 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Learn] This is hard to understand what the logic is here
|
From learn-bounces-at-nylxs.com Wed Mar 29 01:31:31 2017 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 40C11161312; Wed, 29 Mar 2017 01:31:31 -0400 (EDT) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from [10.0.0.62] (flatbush.mrbrklyn.com [10.0.0.62]) by mrbrklyn.com (Postfix) with ESMTP id 3BD80160E77 for ; Wed, 29 Mar 2017 01:31:29 -0400 (EDT) References: <430c32f2-da89-4077-b8a4-a5622fbb6b12.maildroid-at-localhost> To: "learn-at-nylxs.com" From: Ruben Safir X-Forwarded-Message-Id: <430c32f2-da89-4077-b8a4-a5622fbb6b12.maildroid-at-localhost> Message-ID: <712b3023-d054-3b79-5cc0-7bdb158e1e69-at-mrbrklyn.com> Date: Wed, 29 Mar 2017 01:31:29 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <430c32f2-da89-4077-b8a4-a5622fbb6b12.maildroid-at-localhost> Subject: [Learn] This is hard to understand what the logic is here X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
There is a bias included here. The bias is treated as a weight corresponding to a "pseudo" input that is always 1. So for a perceptron with 2 regular inputs, the weight vector will have size 3.
That while loop just appends ones to the input vector until it's big enough to do a dot product of the inputs and weights. The step function returns 0 or 1 but represents them as float because we might want to substitute a different function, such as sigmoid, which would need floats. CL
-----Original Message----- From: Ruben Safir To: Christopher League , "learn-at-nylxs.com"
Sent: Wed, 29 Mar 2017 1:16 Subject: This is hard to understand what the logic is here
float feed_forward(const perceptron& p, vector& input) { // If input size doesn't match, add "bias" inputs: while(input.size() < p.weights.size()) { input.push_back(1); } return step_function(p.threshold, dot_product(p.weights, input)); }
step_function should return an INT
What is the logic to this? Don't you always need the bias?
https://gitlab.liu.edu/cs691s17/public/raw/1dd68b2f00b96db17a988242221f50e4eab7ddbb/perceptrons/perceptrons.cpp
_______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|