udpdates
This commit is contained in:
@@ -217,7 +217,7 @@ in the data set (see the full example below).
|
||||
One simple way to get a discrete output is to have sign
|
||||
functions that map the output of a linear regressor to values \( \{0,1\} \),
|
||||
\( f(s_i)=sign(s_i)=1 \) if \( s_i\ge 0 \) and 0 if otherwise.
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the "perceptron" model in the machine learning
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the ``perceptron" model in the machine learning
|
||||
literature. This model is extremely simple. However, in many cases it is more
|
||||
favorable to use a ``soft" classifier that outputs
|
||||
the probability of a given category. This leads us to the logistic function.
|
||||
|
||||
@@ -206,7 +206,7 @@ MathJax.Hub.Config({
|
||||
<h2 id="___sec26" class="anchor">Simple example </h2>
|
||||
|
||||
<p>
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot for whether a person has had CHD (output = 1) or not (output = 0) is plotted against age. Clearly, the figure shows that attempting to make a standard lineae regression fit may not be very meaningful.
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot whether a person has had CHD (output = 1) or not (output = 0). This ouput is plotted the person's against age. Clearly, the figure shows that attempting to make a standard linear regression fit may not be very meaningful.
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ MathJax.Hub.Config({
|
||||
|
||||
<p>
|
||||
Another widely studied model, is the so-called
|
||||
perceptron model, which is an example of a ``hard classification" model. We
|
||||
perceptron model, which is an example of a "hard classification" model. We
|
||||
will encounter this model when we discuss neural networks as
|
||||
well. Each datapoint is deterministically assigned to a category (i.e
|
||||
\( y_i=0 \) or \( y_i=1 \)). In many cases, and the coronary heart disease data forms one of many such examples, it is favorable to have a "soft"
|
||||
|
||||
@@ -242,12 +242,9 @@ plt<span style="color: #666666">.</span>show()
|
||||
correlation_matrix <span style="color: #666666">=</span> cancerpd<span style="color: #666666">.</span>corr()<span style="color: #666666">.</span>round(<span style="color: #666666">1</span>)
|
||||
<span style="color: #408080; font-style: italic"># use the heatmap function from seaborn to plot the correlation matrix</span>
|
||||
<span style="color: #408080; font-style: italic"># annot = True to print the values inside the square</span>
|
||||
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">15</span>,<span style="color: #666666">8</span>))
|
||||
sns<span style="color: #666666">.</span>heatmap(data<span style="color: #666666">=</span>correlation_matrix, annot<span style="color: #666666">=</span><span style="color: #008000">True</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
|
||||
<span style="color: #408080; font-style: italic">#print eigvalues of correlation matrix</span>
|
||||
EigValues, EigVectors <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linalg<span style="color: #666666">.</span>eig(correlation_matrix)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(EigValues)
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
|
||||
@@ -1333,7 +1333,7 @@ in the data set (see the full example below).
|
||||
One simple way to get a discrete output is to have sign
|
||||
functions that map the output of a linear regressor to values \( \{0,1\} \),
|
||||
\( f(s_i)=sign(s_i)=1 \) if \( s_i\ge 0 \) and 0 if otherwise.
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the "perceptron" model in the machine learning
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the ``perceptron" model in the machine learning
|
||||
literature. This model is extremely simple. However, in many cases it is more
|
||||
favorable to use a ``soft" classifier that outputs
|
||||
the probability of a given category. This leads us to the logistic function.
|
||||
@@ -1344,7 +1344,7 @@ the probability of a given category. This leads us to the logistic function.
|
||||
<h2 id="___sec26">Simple example </h2>
|
||||
|
||||
<p>
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot for whether a person has had CHD (output = 1) or not (output = 0) is plotted against age. Clearly, the figure shows that attempting to make a standard lineae regression fit may not be very meaningful.
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot whether a person has had CHD (output = 1) or not (output = 0). This ouput is plotted the person's against age. Clearly, the figure shows that attempting to make a standard linear regression fit may not be very meaningful.
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1453,7 +1453,7 @@ representing the probability for finding a value of \( y_i \) with a given
|
||||
|
||||
<p>
|
||||
Another widely studied model, is the so-called
|
||||
perceptron model, which is an example of a ``hard classification" model. We
|
||||
perceptron model, which is an example of a "hard classification" model. We
|
||||
will encounter this model when we discuss neural networks as
|
||||
well. Each datapoint is deterministically assigned to a category (i.e
|
||||
\( y_i=0 \) or \( y_i=1 \)). In many cases, and the coronary heart disease data forms one of many such examples, it is favorable to have a "soft"
|
||||
@@ -1852,12 +1852,9 @@ plt.show()
|
||||
correlation_matrix = cancerpd.corr().round(<span style="color: #B452CD">1</span>)
|
||||
<span style="color: #228B22"># use the heatmap function from seaborn to plot the correlation matrix</span>
|
||||
<span style="color: #228B22"># annot = True to print the values inside the square</span>
|
||||
plt.figure(figsize=(<span style="color: #B452CD">15</span>,<span style="color: #B452CD">8</span>))
|
||||
sns.heatmap(data=correlation_matrix, annot=<span style="color: #658b00">True</span>)
|
||||
plt.show()
|
||||
|
||||
<span style="color: #228B22">#print eigvalues of correlation matrix</span>
|
||||
EigValues, EigVectors = np.linalg.eig(correlation_matrix)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(EigValues)
|
||||
</pre></div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1265,7 +1265,7 @@ in the data set (see the full example below).
|
||||
One simple way to get a discrete output is to have sign
|
||||
functions that map the output of a linear regressor to values \( \{0,1\} \),
|
||||
\( f(s_i)=sign(s_i)=1 \) if \( s_i\ge 0 \) and 0 if otherwise.
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the "perceptron" model in the machine learning
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the ``perceptron" model in the machine learning
|
||||
literature. This model is extremely simple. However, in many cases it is more
|
||||
favorable to use a ``soft" classifier that outputs
|
||||
the probability of a given category. This leads us to the logistic function.
|
||||
@@ -1276,7 +1276,7 @@ the probability of a given category. This leads us to the logistic function.
|
||||
<h2 id="___sec26">Simple example </h2>
|
||||
|
||||
<p>
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot for whether a person has had CHD (output = 1) or not (output = 0) is plotted against age. Clearly, the figure shows that attempting to make a standard lineae regression fit may not be very meaningful.
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot whether a person has had CHD (output = 1) or not (output = 0). This ouput is plotted the person's against age. Clearly, the figure shows that attempting to make a standard linear regression fit may not be very meaningful.
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1382,7 +1382,7 @@ representing the probability for finding a value of \( y_i \) with a given
|
||||
|
||||
<p>
|
||||
Another widely studied model, is the so-called
|
||||
perceptron model, which is an example of a ``hard classification" model. We
|
||||
perceptron model, which is an example of a "hard classification" model. We
|
||||
will encounter this model when we discuss neural networks as
|
||||
well. Each datapoint is deterministically assigned to a category (i.e
|
||||
\( y_i=0 \) or \( y_i=1 \)). In many cases, and the coronary heart disease data forms one of many such examples, it is favorable to have a "soft"
|
||||
@@ -1743,12 +1743,9 @@ plt.show()
|
||||
correlation_matrix = cancerpd.corr().round(<span style="color: #B452CD">1</span>)
|
||||
<span style="color: #228B22"># use the heatmap function from seaborn to plot the correlation matrix</span>
|
||||
<span style="color: #228B22"># annot = True to print the values inside the square</span>
|
||||
plt.figure(figsize=(<span style="color: #B452CD">15</span>,<span style="color: #B452CD">8</span>))
|
||||
sns.heatmap(data=correlation_matrix, annot=<span style="color: #658b00">True</span>)
|
||||
plt.show()
|
||||
|
||||
<span style="color: #228B22">#print eigvalues of correlation matrix</span>
|
||||
EigValues, EigVectors = np.linalg.eig(correlation_matrix)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(EigValues)
|
||||
</pre></div>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
@@ -1270,7 +1270,7 @@ in the data set (see the full example below).
|
||||
One simple way to get a discrete output is to have sign
|
||||
functions that map the output of a linear regressor to values \( \{0,1\} \),
|
||||
\( f(s_i)=sign(s_i)=1 \) if \( s_i\ge 0 \) and 0 if otherwise.
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the "perceptron" model in the machine learning
|
||||
We will encounter this model in our first demonstration of neural networks. Historically it is called the ``perceptron" model in the machine learning
|
||||
literature. This model is extremely simple. However, in many cases it is more
|
||||
favorable to use a ``soft" classifier that outputs
|
||||
the probability of a given category. This leads us to the logistic function.
|
||||
@@ -1281,7 +1281,7 @@ the probability of a given category. This leads us to the logistic function.
|
||||
<h2 id="___sec26">Simple example </h2>
|
||||
|
||||
<p>
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot for whether a person has had CHD (output = 1) or not (output = 0) is plotted against age. Clearly, the figure shows that attempting to make a standard lineae regression fit may not be very meaningful.
|
||||
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot whether a person has had CHD (output = 1) or not (output = 0). This ouput is plotted the person's against age. Clearly, the figure shows that attempting to make a standard linear regression fit may not be very meaningful.
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1387,7 +1387,7 @@ representing the probability for finding a value of \( y_i \) with a given
|
||||
|
||||
<p>
|
||||
Another widely studied model, is the so-called
|
||||
perceptron model, which is an example of a ``hard classification" model. We
|
||||
perceptron model, which is an example of a "hard classification" model. We
|
||||
will encounter this model when we discuss neural networks as
|
||||
well. Each datapoint is deterministically assigned to a category (i.e
|
||||
\( y_i=0 \) or \( y_i=1 \)). In many cases, and the coronary heart disease data forms one of many such examples, it is favorable to have a "soft"
|
||||
@@ -1748,12 +1748,9 @@ plt<span style="color: #666666">.</span>show()
|
||||
correlation_matrix <span style="color: #666666">=</span> cancerpd<span style="color: #666666">.</span>corr()<span style="color: #666666">.</span>round(<span style="color: #666666">1</span>)
|
||||
<span style="color: #408080; font-style: italic"># use the heatmap function from seaborn to plot the correlation matrix</span>
|
||||
<span style="color: #408080; font-style: italic"># annot = True to print the values inside the square</span>
|
||||
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">15</span>,<span style="color: #666666">8</span>))
|
||||
sns<span style="color: #666666">.</span>heatmap(data<span style="color: #666666">=</span>correlation_matrix, annot<span style="color: #666666">=</span><span style="color: #008000">True</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
|
||||
<span style="color: #408080; font-style: italic">#print eigvalues of correlation matrix</span>
|
||||
EigValues, EigVectors <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linalg<span style="color: #666666">.</span>eig(correlation_matrix)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(EigValues)
|
||||
</pre></div>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
Binary file not shown.
+100
-199
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user