I’m a student from India keen to learn about Machine Learning, Deep Learning, and TensorFlow. Since the quality of education in our institution is not up to the mark, the only way to get a viable career option in the future for me is to take this course. Since I am a student and our college does not permit a part-time job, I would not be able to carry the expenses to pay for the certificate of this course. Financial Aid will help me take this course without any adverse impact on my monthly essential needs. I am really excited for this course since it presents me with a great opportunity to grow my skills and become a professional in this field as I graduate in the same or prospective fields with a great resume.
function createModel() { | |
// Create a sequential model | |
const model = tf.sequential(); | |
// Add a single input layer | |
model.add(tf.layers.dense({inputShape: [1], units: 1, useBias: true})); | |
// Add an output layer | |
model.add(tf.layers.dense({units: 1, useBias: true})); |
const model = createModel(); | |
tfvis.show.modelSummary({name: 'Model Summary'}, model); |
/** | |
* Convert the input data to tensors that we can use for machine | |
* learning. We will also do the important best practices of _shuffling_ | |
* the data and _normalizing_ the data | |
* MPG on the y-axis. | |
*/ | |
function convertToTensor(data) { | |
// Wrapping these calculations in a tidy will dispose any | |
// intermediate tensors. | |
async function trainModel(model, inputs, labels) { | |
// Prepare the model for training. | |
model.compile({ | |
optimizer: tf.train.adam(), | |
loss: tf.losses.meanSquaredError, | |
metrics: ['mse'], | |
}); | |
const batchSize = 32; | |
const epochs = 50; |
function testModel(model, inputData, normalizationData) { | |
const {inputMax, inputMin, labelMin, labelMax} = normalizationData; | |
// Generate predictions for a uniform range of numbers between 0 and 1; | |
// We un-normalize the data by doing the inverse of the min-max scaling | |
// that we did earlier. | |
const [xs, preds] = tf.tidy(() => { | |
const xs = tf.linspace(0, 1, 100); | |
const preds = model.predict(xs.reshape([100, 1])); |
# Python | |
import numpy as np | |
a = np.arange(15).reshape(3, 5) | |
print(a.shape == (3, 5)) # True | |
print(a.ndim == 2) # True | |
print(a.dtype.name) # 'int64' | |
b = (np.arange(15) ** 2).reshape(3, 5) |
// Kotlin | |
import org.jetbrains.numkt.* | |
fun main() { | |
val a = arange(15).reshape(3, 5) | |
println(a.shape.contentEquals(intArrayOf(3, 5))) // true | |
println(a.ndim == 2) // true | |
println(a.dtype) // class java.lang.Integer |
``` | |
We can also save the model parameters in a JSON file and load them back. | |
In the example below, we will save the model coefficients and intercept and load them back. | |
We will first import the json library, create a dictionary containing the coefficients and intercept. | |
Coefficients and intercept are an array object. | |
We cannot dump an array into JSON strings so we convert the array to a list and store it in the dictionary | |
``` | |
import json | |
model_param = {} |
This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”), and conveys certain license rights to Rishit Dagli for Your contributions to Rishit Dagli's open source projects. This Agreement is effective upon Your acknowledgment via the CLA Assistant tool. All prospective contributors to Rishit Dagli's open source projects must sign this Agreement (digitally or otherwise) before any changes will be merged.
“Code” means the computer software code, whether in human-readable or machine-executable form, that is delivered by You to Rishit Dagli under this Agreement.
“Project” means any of the projects owned or managed by Rishit Dagli in which software is offered under a license approved by the Open Source Initiative (OSI) (www.opensource.org) and/or documentation offered under an OSI or a Creative Commons license (https://creativecommons.org/licenses).
“Submit” is the act of uploading, submitting, transmitting, or distribu