<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Quick Intro to Python
Math and Modules
In the space below and use Python as a calculator.
Now let's try some more advanced funtions.
Step1:  The standard Python distribution only comes with the bare-bone capabilities. Other functionality can be accessed through modules using the import command. To access a function using the following syntax.
import &lt;module&gt;
&lt;module&gt;.&lt;function&gt;
Here's an example.
Step2:  What if I don't know how to use a function, you can access the documentation.
? &lt;module&gt;.&lt;function&gt;
Let's look at the documentation of math.log10
Step3:  Strings
Strings are denoted by ' or ". Set the variable my_name equal to your name full name.
Step4:  Strings can all be indexed.
Step5:  Try and pick out all of your initials.
Step6:  SciPy and NumPy
SciPy and NumPy are two highly optimized core packages used for scientific computing in the Python community.
* NumPy - Numerical computation in Python
* SciPy - Scientific computation in Python
Let's import numpy and make a numpy array.
Step7:  Use the cell below to manipulate the array we just created.
Step8:  Let's do some simple matrix multiplication using np.dot.
$$ \mathbf{A} \overrightarrow{x} = \overrightarrow{y}$$
First checkout the documentation of np.dot.
Step9:  Use the cell below to call another function from NumPy.
Scikit-Learn
Scikit-Learn, a.k.a. sklearn, is a scientific toolkit (there are many others) for machine learning and it built on SciPy and NumPy.
Below is an example from scikit-learn for linear regression.
This example also using the plotting library matplotlib to display the results.
<ASSISTANT_TASK:>
Python Code:
log10(10)
Explanation: Quick Intro to Python
Math and Modules
In the space below and use Python as a calculator.
Now let's try some more advanced funtions.
End of explanation
import math
math.log10(10)
Explanation: The standard Python distribution only comes with the bare-bone capabilities. Other functionality can be accessed through modules using the import command. To access a function using the following syntax.
import &lt;module&gt;
&lt;module&gt;.&lt;function&gt;
Here's an example.
End of explanation
?? math.log10
Explanation: What if I don't know how to use a function, you can access the documentation.
? &lt;module&gt;.&lt;function&gt;
Let's look at the documentation of math.log10
End of explanation
my_name = 
intro = 'Hello, my name is '
print(intro + my_name + '.')
Explanation: Strings
Strings are denoted by ' or ". Set the variable my_name equal to your name full name.
End of explanation
first_initial = 'My first initial is '
print(first_initial + my_name[0] + '.')
Explanation: Strings can all be indexed.
End of explanation
initials = 'My initials are '
print(initials + my_name[0] + my_name[] + ".")
Explanation: Try and pick out all of your initials.
End of explanation
import numpy as np
B = np.ones((3, 3))
print(B)
Explanation: SciPy and NumPy
SciPy and NumPy are two highly optimized core packages used for scientific computing in the Python community.
* NumPy - Numerical computation in Python
* SciPy - Scientific computation in Python
Let's import numpy and make a numpy array.
End of explanation
B + B
Explanation: Use the cell below to manipulate the array we just created.
End of explanation
? np.dot
N = 5
A = np.eye(N) * 2
x = np.arange(N)
print('A =')
print(A)
print('x =')
print(x)
= np.dot(A, x)
print('y =')
print(y)
Explanation: Let's do some simple matrix multiplication using np.dot.
$$ \mathbf{A} \overrightarrow{x} = \overrightarrow{y}$$
First checkout the documentation of np.dot.
End of explanation
%matplotlib inline
# Code source: Jaques Grobler
# License: BSD 3 clause
import matplotlib.pyplot as plt
from sklearn import datasets, linear_model
# Load the diabetes dataset
diabetes = datasets.load_diabetes()
# Use only one feature
diabetes_X = diabetes.data[:, np.newaxis]
diabetes_X_temp = diabetes_X[:, :, 2]
# Split the data into training/testing sets
diabetes_X_train = diabetes_X_temp[:-20]
diabetes_X_test = diabetes_X_temp[-20:]
# Split the targets into training/testing sets
diabetes_y_train = diabetes.target[:-20]
diabetes_y_test = diabetes.target[-20:]
# Create linear regression object
regr = linear_model.LinearRegression()
# Train the model using the training sets
regr.fit(diabetes_X_train, diabetes_y_train)
# Predict result
y = regr.predict(diabetes_X_test)
# The coefficients
print('Coefficients: \n', regr.coef_)
# The mean square error
print("Residual sum of squares: %.2f"
      % np.mean((y - diabetes_y_test) ** 2))
# Explained variance score: 1 is perfect prediction
print('Variance score: %.2f' % regr.score(diabetes_X_test, diabetes_y_test))
# Plot outputs
plt.scatter(diabetes_X_test, diabetes_y_test,  color='black')
plt.plot(diabetes_X_test, y, color='blue', linewidth=3)
plt.xticks(())
plt.yticks(())
plt.show()
Explanation: Use the cell below to call another function from NumPy.
Scikit-Learn
Scikit-Learn, a.k.a. sklearn, is a scientific toolkit (there are many others) for machine learning and it built on SciPy and NumPy.
Below is an example from scikit-learn for linear regression.
This example also using the plotting library matplotlib to display the results.
End of explanation
<END_TASK>