草图大师自带模型库在哪里
It’s time for you to open or download your IDLE Python CodeRunner right now. You’ve been seeing projects revolving around neural networks (NN), and people doing amazing things in machine learning, but you’ve never delved into it yourself. But why is that? It’s probably because the idea of developing cortexes and neurons, and a computerized system sounds way too complex and almost uncanny. Well, I’m here to tell you that this is a common misconception that will prevent you from being able to wrap yourself in the amazing applications of artificial intelligence (AI). What if I told you that you can make a neural network model in under twenty minutes? What if I told you that you can make one in 7 lines of code? In 60 lines of code? All of sudden, AI becomes a much more appealing and intuitive programming paradigm. This neural network you’re going to build will allow you to input three values, and the neural network will predict your fourth value output! Well, now that you’re in the right frame of mind, we can get right into building your first neural network! As we go on, you will notice we are dealing with a lot of math (especially Linear Algebra and Calculus), so you can choose to read it, or study it! If you are here just for the coding, feel free to skip!
现在您该打开或下载IDLE Python CodeRunner 。 您曾经看到过围绕神经网络 (NN)进行的项目,人们在机器学习中做着令人惊奇的事情,但是您从未亲自研究过它。 但是为什么呢? 可能是因为开发皮质和神经元以及计算机化系统的想法听起来过于复杂,而且几乎不可思议。 好吧,我在这里告诉您,这是一个常见的误解,将使您无法将自己包裹在人工智能 (AI)的惊人应用中。 如果我告诉您可以在二十分钟内建立神经网络模型,该怎么办? 如果我告诉您可以编写7行代码怎么办? 在60行代码中? 突然之间,AI变成了一种更具吸引力和直观的编程范例。 您将要构建的神经网络将允许您输入三个值,而神经网络将预测您的第四个值输出! 好了,既然您处于正确的心态,我们就可以正确构建您的第一个神经网络! 继续进行时,您会注意到我们正在处理大量数学(尤其是线性代数和微积分),因此您可以选择阅读或研究它! 如果你在这里只是为了编码,随意跳过!
A neural network can be considered as a facet of machine learning artificial intelligence, which is a programmatic system through which computers can learn like humans and complete given tasks by being trained through observation data sets, typically in the form of comma-separated values files, or .csv files, that have a variety of different quantitative values that are indicative of a specific metric. It is important to note that machine learning is unique in the sense that it doesn’t require the program to explicitly coded, which differs from other forms of programmatic function execution, where specificity is used. In this article, you will be developing an artificial neural network (ANN) that will be able to use regression to predict a quantity in a binary — 0 and 1 — dataset. In the dataset, the first number in the sequence determines the output. The data set is as follows:
神经网络可以看作是机器学习人工智能的一个方面,这是一个程序化系统,通过该系统,计算机可以像人类一样学习,并通过观察数据集 (通常以逗号分隔的值文件的形式)进行训练来完成给定的任务,或.csv文件,它们具有表示特定指标的各种不同的定量值。 重要的是要注意,机器学习是唯一的,因为它不需要程序进行显式编码,这与使用特定性的其他形式的编程功能执行不同。 在本文中,您将开发一个人工神经网络 (ANN),它将能够使用回归来预测二进制( 0和1)数据集中的数量。 在数据集中,序列中的第一个数字确定输出。 数据集如下:
To begin, you’ll need to open a new project in Python IDLE. We will be using NumPy as our primary library framework, so you’ll need to import the function using the import module function. Before importing, go into your terminal and call pip3 (pip for non-Macs). For NumPy, this would be pip3 install NumPy, or pip install NumPy.
首先,您需要在Python IDLE中打开一个新项目。 我们将使用NumPy作为我们的主要库框架,因此您需要使用导入模块函数来导入该函数。 导入之前,请进入您的终端并致电pip3(非Mac机为pip)。 对于NumPy,这将是pip3 install NumPy或pip install NumPy。
Snippet 1: import function for NumPy, written “as np”; makes code shorter, functions can be called as .np() 片段1:NumPy的导入功能,写为“ as np”; 使代码更短,函数可以称为.np()Above is our ‘perceptron’, which is the neural network’s means of thinking and functioning. As shown in the mathematic model, our foreign input scenario and three pieces of data are run through multiple synapses corresponding to each metric, and then e information to a neuron that processes and learns it via a sigmoid normalizing function, which is based on the training models. This then allows us to get an output for our given input, which will only slightly deviate from the correct 1 or 0 answers (as regression principles prevent the neural network from landing on a set value). Our sigmoid value can be graphed as any range between 1 and 0, shown in the graph below, in which the 0 and 1 y values act as asymptotes to the function. As x approaches 0, y approaches ∞, and as y approaches 1, x approaches -∞.
上面是我们的“感知器 ”,它是神经网络的思维和功能手段。 如数学模型所示,我们的外来输入场景和三段数据通过与每个度量对应的多个突触运行,然后将信息传递给神经元,该神经元通过基于训练的S形归一化函数进行处理和学习楷模。 然后,这将使我们能够获得给定输入的输出,该输出只会稍微偏离正确的1或0答案(因为回归原理会阻止神经网络落在设定值上)。 我们的S形值可以表示为介于1和0之间的任意范围,如下图所示,其中0和1 y值 充当该函数的渐近线。 当x接近0时, y接近∞,而当y接近1时, x接近-∞。
Sigmoid function derivative displayed graphically showing 0 and 1 as approached asymptotes due to regression S形函数导数以图形方式显示,由于回归,渐近渐近线显示0和1To create the neural network, we define it as a class. Due to python being an object-oriented language, classes are object constructors, which are the default frameworks when creating Python objects. Our development steps are inputs, weights, and process definition → calculation → sigmoid normalization → training procedurals → error quantification error weighted derivatives → necessary adjustments to make confident neurons → backpropagation.
为了创建神经网络,我们将其定义为class 。 由于python是一种面向对象的语言,因此类是对象构造函数,它们是创建Python对象时的默认框架。 我们的开发步骤包括输入,权重和过程定义→计算→乙状结肠归一化→训练程序→误差量化误差加权导数→进行必要的调整以产生自信的神经元→反向传播。
Function for determining adjustment necessities. 确定调整必要性的功能。 Completing backpropagation requires revised weights on synapses and new output. 完成反向传播需要修改突触的权重和新的输出。We will then self-initialize and randomize for our necessary circumvention. This name mangling prevents improper convolutions in our naming of variables. The self is a name basing to store variables for use. During this period, we’ll also define our synaptic weights, which help the neuron in determining values that are given by the synapses. After defining synaptic weights, we need to define our sigmoid function and derivative for a successful task execute via the neuron. Now, our code will look like this:
然后,我们将针对必要的回避进行自我初始化和随机化。 这种名称修饰可以防止我们在变量命名中进行不正确的卷积。 自我是一个用来存储要使用的变量的名称。 在此期间,我们还将定义突触权重,以帮助神经元确定突触给出的值。 定义突触权重后,我们需要定义S型函数和导数 ,以通过神经元成功执行任务。 现在,我们的代码将如下所示:
Snippet 2: Neural Network Class Neuron definition 片段2:神经网络类神经元定义We have successfully defined the necessary neuron facets. Now, we will just need to create functions for thinking and training via our data set. The think function is relatively simple and quite comprehensive. We simply enter our self parameter, as well as the inputs parameter for when we test the network. We then define our given inputs as floats and qualify the newly-defined output using our sigmoid and synaptic weight function through the dot product (·) function, which is said as np.dot, instead of numpy.dot, as we already assigned a nickname for the NumPy module when we imported it into the program (see the first snippet). We then return the output so that it is displayed when running the program. For our train function, we have four parameters: self, training_inputs, training_outputs, and training_iterations. We give specific high math parameters for our iterations and define our updated output through the training inputs from the dataset, and then the error margin by subtracting the correct outputs from the model’s output, the adjustment using .T, error, training_inputs, and our self.sigmoid function with the output parameter. We will also redefine the synaptic weights by adding the original value to the adjustments variable, as shown below:
我们已经成功定义了必要的神经元方面。 现在,我们只需要通过我们的数据集创建思考和培训功能。 思维功能相对简单并且相当全面。 我们只需输入我们的自我参数,以及测试网络时的输入参数即可。 然后,我们定义我们给出的输入,花车和使用我们的乙状结肠和突触权重函数通过点积 (·)功能,据说这是因为np.dot符合新定义的输出 ,而不是numpy.dot,因为我们已经分配将NumPy模块导入程序时的昵称(请参阅第一个片段)。 然后,我们返回输出,以便在运行程序时将其显示出来。 对于我们的训练函数 ,我们有四个参数: self,training_inputs,training_outputs和training_iterations 。 我们为迭代提供特定的高级数学参数,并通过数据集中的训练输入定义更新后的输出 ,然后通过从模型输出中减去正确的输出,使用.T,error,training_inputs和我们自身的调整来定义误差余量 .sigmoid函数以及输出参数。 我们还将通过将原始值添加到调整变量中来重新定义突触权重,如下所示:
Think and train functions defined. 思考并训练功能。Finally, we will define our __main__ function, in which we will define our dataset (syntax shown in image) and extrapolate patterns from the training inputs and outputs. For the sake of simplicity and quick training, we are not using a super large .csv files and will enter the dataset manually. We will then use our ANN training function to allow the NN to sift through the multiple datasets, and understanding the correlation between input and output, which in this case, is the first number in each single-matrix set. We will be creating a 1,000 epoch for updating weights (“In computing, an epoch is a date and time from which a computer measures system time. Most computer systems determine time as a number representing the seconds removed from particular arbitrary date and time”). We will then also print the values of the synaptic weights that were previously defined and then quantified. We will also be adding user input statements defined as A, B, and C, through which users can enter a new and random statement to test the neural network. We then print the display and allow for the NN to process the input data and give the correct output by using np.array. The final code is shown below.
最后,我们将定义__main__函数,其中将定义我们的数据集(图像中显示的语法),并从训练输入和输出中推断模式。 为了简单起见和快速培训,我们没有使用超大的.csv文件,而是会手动输入数据集。 然后,我们将使用我们的ANN训练功能,使NN可以筛选多个数据集,并了解输入和输出之间的相关性,在这种情况下,这是每个单矩阵集中的第一个数字。 我们将创建1,000个纪元来更新权重(“纪元是计算机测量系统时间的日期和时间。大多数计算机系统将时间确定为代表从特定任意日期和时间中删除的秒数的数字”) 。 然后,我们还将打印先前定义然后量化的突触权重值。 我们还将添加定义为A,B和C的用户输入语句,用户可以通过它们输入新的随机语句来测试神经网络。 然后,我们打印显示内容,并允许NN通过使用np.array处理输入数据并提供正确的输出。 最终代码如下所示。
Snippet 4: Final program for full framework! 片段4:完整框架的最终程序!After doing this, when you run and save your code, you should see this, after entering the A, B, C input = [0, 1, 1] foreign dataset. If you get 0… ta-da! Your new ANN model is working properly!
这样做,当你运行并保存代码后,你应该看到这一点 ,进入A,B,C输入= [0,1,1]国外的数据集之后。 如果您得到0…ta-da! 您的新ANN模型运行正常!
Output when your inputs are [0, 1, 1] (Output super close to zero) 输入为[0,1,1]时的输出(输出超级接近零)With that, congratulations! You just built your first simple neural network using Python and PyTorch with a 6-minute read and 20 minutes or less of programming! And it’s 65 lines in total! That’s about 11 lines of code per minute you just learned. 🧠 👨🏾💻 Feel free to keep adding datasets to improve your model! You should be very proud. Unfortunately, I don’t have any certificates to give out, but give yourself a pat on the back!
祝贺您! 您刚刚使用Python和PyTorch构建了您的第一个简单的神经网络,只需6分钟的阅读时间和20分钟或更短的编程时间! 总共65行! 您刚刚学习的每分钟大约有11行代码 。 💻随时继续添加数据集以改善您的模型! 你一定很自豪吧。 不幸的是,我没有任何要颁发的证书,但请拍一下自己的背!
**Also, feel free to contact me if you want to discuss more projects, or learn more! I’m always looking to develop new and improved proprietary AI models! — Okezue
** 另外,如果您想讨论更多项目或了解更多信息,请随时与我联系。 我一直在寻求开发新的和改进的专有AI模型! — Okezue
翻译自: https://medium.com/swlh/master-create-your-first-neural-network-model-in-20-minutes-or-less-b5a2677ea0a2
草图大师自带模型库在哪里
相关资源:四史答题软件安装包exe