MESSAGE
DATE | 2017-03-30 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Learn] randomize with commentary
|
From learn-bounces-at-nylxs.com Thu Mar 30 14:20:23 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 575B0161311; Thu, 30 Mar 2017 14:20:23 -0400 (EDT) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id 86A3C160E77 for ; Thu, 30 Mar 2017 14:20:21 -0400 (EDT) Received: from [172.22.149.146] (182631b.cst.lightpath.net [24.38.3.27]) by mailbackend.panix.com (Postfix) with ESMTPSA id 205771ABA9; Thu, 30 Mar 2017 14:20:17 -0400 (EDT) To: Christopher League , learn-at-nylxs.com From: Ruben Safir Message-ID: <58DD4C61.9060901-at-panix.com> Date: Thu, 30 Mar 2017 14:20:17 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 MIME-Version: 1.0 Subject: [Learn] randomize with commentary 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
28 template 29 void create_random_weights( std::vector weights) 30 { 31 const int scale = 2; 32 for(auto x : weights){ 33 double tmp = ( (double)rand() / RAND_MAX );//creates a large fraction 34 //that is less than one 35 //multiply by the scale 36 tmp *= scale; 37 //double the scale in order to double the range 38 tmp *= 2; 39 //center the range about zero 40 tmp -= scale; 41 x = tmp; 42 } 43 }
_______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|