| chipKIT Sketch Help |
A message displays stating that it is importing the project and it may take a while (see Figure: Importing the Project). During this time, the core libraries are building the program and setting up the project in MPLAB X.Figure: Importing the ProjectThe project view has been populated with the source files (.cpp/.c/.S/.h) that are produced by the Arduino IDE when it compiles the Sketch. All the files needed to compile the sketch are added to the project. See Figure: Project View.Figure: Project View
|
Microchip Support
Help Updated: 2017-04-13 14:25:13Z
Help Page: 19
|


Touch Tools Example
This page contains an example of all the touch-capable tools.
Load this on a mobile device.
Go back to the Examples page
Select tool
Tools
WW/WC
Pan
Rotate
Zoom (pinch)
Zoom (drag)
Stack Scroll
Length
Probe
Ellipse
Rectangle
Angle
Clear Tools
Reset View
Fullscreen
Patient Name
Hospital
Zoom:
WW/WC:


Let's Get In Touch!
Linkedin | EmailInterested in working together?
Fill out this awesome form below.
Chi Su is a 3D / UX Design professional with extensive training in 3D animation. She graduated from School of Visual Arts in New York in 2017. Currently she is making an transition to UI/UX field. She is a quick learner and a highly motivated problem solver. In her spare time, she focuses on refining her skills as a UI/UX Designer, keep up to date with the latest trends for Graphic and Interactive Design, and learning to code better.
ResumeInterested in working together?
Fill out this awesome form below.


Care Plus is a group home, meaning a home like residential facility in a given community where individual with physical or mental disability reside.
We believe that allowing mentally challenged people to live in the private homes, favorizes their integration in the community and most of all, increases public awareness on the crucial problem of mental illness.
Through the opening of Care Plus, we like to bring our modest contribution to the resolution of the mental health stigma.
Our vision is to create a healthy, therapeutic, loving and safe environment where our residents interact in harmony with the support of our staff.
We value the people we serve by giving them respect and dignity.
Knowledge is power; understand mental health
Quality of services to our residents
Commitment: we are committed to the wellbeing of our residents
We value integrity in health care
Collaboration amount care providers.
We care for the well-being of our residents. Our goal is to improve the quality of life of mentally challenged people in a home like setting.
By providing our residents the best compassionate and competent care for their needs, we give them the power to be the best they can be and help them reach their maximum individual potential. To facilitate their integration in the community.
By the creation of a home safe like environment, we want to maximize the level of independence of our residents and improve their daily living skills.
A thorough health assessment and evaluation of each individual is done upon admission allowing an efficient implementation of a care plan specific to each client.
Self-care skills are taught and encouraged as possible (Bathing, dressing, meal preparation, self-feeding, home maintenance).
We encourage social interaction and promote healthy relationship
We provide assistance with medications administration and management
We encourage sports activities as possible
We provide 24 hours, residential supervision
We provide transportation for our residents to: medical appointments/outing
We educate our staff and participate in abuse and neglect prevention.
The Personal Care Assistant at Care Plus are the back bone of the company because they carry out the implementation of the care plan and interact closely and daily with the residents.
fire Care Plus support an atmosphere of teamwork, learning, growth and collaboration amount the care providers.


ensemble.loadRows
Load specific rows of the used subset of a saved ensemble
Syntax
Description
Loads specific rows of the ensemble into memory. The rows are determined relative to the subset of the saved ensemble that is being used by the ensemble object. Only the elements of variables being used by the ensemble are counted as state vector rows. By default, the ensemble object uses all variables saved in the .ens file. Use the “useVariables” command to instead load a subset of the saved variables.
If the ensemble object implements a static ensemble, then the output array is a matrix with one row per requested row, and one column per used ensemble member. If the object implements an evolving ensemble, then the output array is a 3D array, and the third dimension holds the requested rows for different ensembles in the evolving set.
Also returns the ensemble members and evolving labels associated with the loaded datast.
Load rows for specific ensembles in the evolving set. The output array will be a 3D matrix and the length of the third dimension will match the number of requested ensembles. If the second input is -1, selects all ensembles in the evolving set.
Input Arguments
rows
e
labels
Output Arguments
X
members
.ens file. The columns of “members” list the ensemble members for different loaded evolving ensembles.


0 && $password !== $cpassword) { echo "Email already exist and Password is also not matching"; } elseif($emailcount>0) { ?>
Sign Up
Please fill in the form to create an account
Selecct Your Hobbies
Travelling
Cooking
Photography
Programming
Music
Sign Up


In this project, you'll use generative adversarial networks to generate new images of faces.
You'll be using two datasets in this project:
Since the celebA dataset is complex and you're doing GANs in a project for the first time, we want you to test your neural network on MNIST before CelebA. Running the GANs on MNIST will allow you to see how well your model trains sooner.
If you're using FloydHub, set data_dir
to "/input" and use the FloydHub data ID "R5KrjnANiKVhLWAkpXhNBe".
data_dir = './data'
# FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe"
#data_dir = '/input'
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
helper.download_extract('mnist', data_dir)
helper.download_extract('celeba', data_dir)
show_n_images = 25
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
%matplotlib inline
import os
from glob import glob
from matplotlib import pyplot
mnist_images = helper.get_batch(glob(os.path.join(data_dir, 'mnist/*.jpg'))[:show_n_images], 28, 28, 'L')
pyplot.imshow(helper.images_square_grid(mnist_images, 'L'), cmap='gray')
The CelebFaces Attributes Dataset (CelebA) dataset contains over 200,000 celebrity images with annotations. Since you're going to be generating faces, you won't need the annotations. You can view the first number of examples by changing show_n_images
.
show_n_images = 25
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
mnist_images = helper.get_batch(glob(os.path.join(data_dir, 'img_align_celeba/*.jpg'))[:show_n_images], 28, 28, 'RGB')
pyplot.imshow(helper.images_square_grid(mnist_images, 'RGB'))
Since the project's main focus is on building the GANs, we'll preprocess the data for you. The values of the MNIST and CelebA dataset will be in the range of -0.5 to 0.5 of 28x28 dimensional images. The CelebA images will be cropped to remove parts of the image that don't include a face, then resized down to 28x28.

You'll build the components necessary to build a GANs by implementing the following functions below:
model_inputs
discriminator
generator
model_loss
model_opt
train
This will check to make sure you have the correct version of TensorFlow and access to a GPU
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
from distutils.version import LooseVersion
import warnings
import tensorflow as tf
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer. You are using {}'.format(tf.__version__)
print('TensorFlow Version: {}'.format(tf.__version__))
# Check for a GPU
if not tf.test.gpu_device_name():
warnings.warn('No GPU found. Please use a GPU to train your neural network.')
else:
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
Implement the model_inputs
function to create TF Placeholders for the Neural Network. It should create the following placeholders:
image_width
, image_height
, and image_channels
.z_dim
.Return the placeholders in the following the tuple (tensor of real input images, tensor of z data)
import problem_unittests as tests
def model_inputs(image_width, image_height, image_channels, z_dim):
"""
Create the model inputs
:param image_width: The input image width
:param image_height: The input image height
:param image_channels: The number of image channels
:param z_dim: The dimension of Z
:return: Tuple of (tensor of real input images, tensor of z data, learning rate)
"""
# TODO: Implement Function
real_input = tf.placeholder(tf.float32, (None, image_width, image_height, image_channels), name='real_input')
z_data = tf.placeholder(tf.float32, (None, z_dim), name='z_data')
learning_rate = tf.placeholder(tf.float32, name='learning_rate')
return real_input, z_data, learning_rate
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_inputs(model_inputs)
Implement discriminator
to create a discriminator neural network that discriminates on images
. This function should be able to reuse the variabes in the neural network. Use tf.variable_scope
with a scope name of "discriminator" to allow the variables to be reused. The function should return a tuple of (tensor output of the discriminator, tensor logits of the discriminator).
def discriminator(images, reuse=False):
"""
Create the discriminator network
:param image: Tensor of input image(s)
:param reuse: Boolean if the weights should be reused
:return: Tuple of (tensor output of the discriminator, tensor logits of the discriminator)
"""
# TODO: Implement Function
alpha = 0.1
with tf.variable_scope('discriminator', reuse=reuse):
conv1 = tf.layers.conv2d(images, 32, 5, strides=2, padding='same')
relu1 = tf.maximum(alpha * conv1, conv1)
# 14x14x64
conv2 = tf.layers.conv2d(relu1, 64, 5, strides=2, padding='same')
bn2 = tf.layers.batch_normalization(conv2, training=True)
relu2 = tf.maximum(alpha * bn2, bn2)
# 7x7x128
conv3 = tf.layers.conv2d(relu2, 128, 5, strides=2, padding='same')
bn3 = tf.layers.batch_normalization(conv3, training=True)
relu3 = tf.maximum(alpha * bn3, bn3)
# 4x4x256
# conv4 = tf.layers.conv2d(relu3, 256, 5, strides=2, padding='same')
# bn4 = tf.layers.batch_normalization(conv4, training=True)
# relu4 = tf.maximum(alpha * bn4, bn4)
# # 2x2x512
relu3_shape = relu3.get_shape().as_list()
# Flatten it
flat = tf.reshape(relu3, (-1, relu3_shape[1]*relu3_shape[2]*relu3_shape[3]))
logits = tf.layers.dense(flat, 1)
output = tf.sigmoid(logits)
return output, logits
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_discriminator(discriminator, tf)
Implement generator
to generate an image using z
. This function should be able to reuse the variabes in the neural network. Use tf.variable_scope
with a scope name of "generator" to allow the variables to be reused. The function should return the generated 28 x 28 x out_channel_dim
images.
def generator(z, out_channel_dim, is_train=True):
"""
Create the generator network
:param z: Input z
:param out_channel_dim: The number of channels in the output image
:param is_train: Boolean if generator is being used for training
:return: The tensor output of the generator
"""
# TODO: Implement Function
with tf.variable_scope('generator', reuse = not is_train):
alpha = 0.1
# First fully connected layer
fc1 = tf.layers.dense(z, 4*4*512)
# Reshape it to start the convolutional stack
reshape1 = tf.reshape(fc1, (-1, 4, 4, 512))
bn1 = tf.layers.batch_normalization(reshape1, training=is_train)
relu1 = tf.maximum(alpha * bn1, bn1)
# 4x4x512
deconv2 = tf.layers.conv2d_transpose(relu1, 128, 4, strides=1, padding='valid')
bn2 = tf.layers.batch_normalization(deconv2, training=is_train)
relu2 = tf.maximum(alpha * bn2, bn2)
# 4x4x256
deconv3 = tf.layers.conv2d_transpose(relu2, 64, 5, strides=2, padding='same')
bn3 = tf.layers.batch_normalization(deconv3, training=is_train)
relu3 = tf.maximum(alpha * bn3, bn3)
# 7x7x128
deconv4 = tf.layers.conv2d_transpose(relu3, 32, 5, strides=2, padding='same')
bn4 = tf.layers.batch_normalization(deconv4, training=is_train)
relu4 = tf.maximum(alpha * bn4, bn4)
# 14x14x64
# Output layer
logits = tf.layers.conv2d_transpose(relu4, out_channel_dim, 3, strides=1, padding='same')
output = tf.tanh(logits)
# 28x28x3
return output
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_generator(generator, tf)
Implement model_loss
to build the GANs for training and calculate the loss. The function should return a tuple of (discriminator loss, generator loss). Use the following functions you implemented:
discriminator(images, reuse=False)
generator(z, out_channel_dim, is_train=True)
def model_loss(input_real, input_z, out_channel_dim):
"""
Get the loss for the discriminator and generator
:param input_real: Images from the real dataset
:param input_z: Z input
:param out_channel_dim: The number of channels in the output image
:return: A tuple of (discriminator loss, generator loss)
"""
# TODO: Implement Function
#build the model
g_model = generator(input_z, out_channel_dim)
# g_model is the generator output
d_model_real, d_logits_real = discriminator(input_real)
d_model_fake, d_logits_fake = discriminator(g_model, reuse=True)
# Calculate losses
d_loss_real = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_real, labels=tf.ones_like(d_model_real) * 0.9))
d_loss_fake = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_fake, labels=tf.zeros_like(d_model_fake)))
d_loss = d_loss_real + d_loss_fake
g_loss = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_fake, labels=tf.ones_like(d_model_fake)))
return d_loss, g_loss
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_loss(model_loss)
Implement model_opt
to create the optimization operations for the GANs. Use tf.trainable_variables
to get all the trainable variables. Filter the variables with names that are in the discriminator and generator scope names. The function should return a tuple of (discriminator training operation, generator training operation).
def model_opt(d_loss, g_loss, learning_rate, beta1):
"""
Get optimization operations
:param d_loss: Discriminator loss Tensor
:param g_loss: Generator loss Tensor
:param learning_rate: Learning Rate Placeholder
:param beta1: The exponential decay rate for the 1st moment in the optimizer
:return: A tuple of (discriminator training operation, generator training operation)
"""
# TODO: Implement Function
# Get the trainable_variables, split into discriminator set and generator set
t_vars = tf.trainable_variables()
d_vars = [var for var in t_vars if var.name.startswith('discriminator')]
g_vars = [var for var in t_vars if var.name.startswith('generator')]
with tf.control_dependencies(tf.get_collection(tf.GraphKeys.UPDATE_OPS)):
d_train_opt = tf.train.AdamOptimizer(learning_rate, beta1).minimize(d_loss, var_list=d_vars)
g_train_opt = tf.train.AdamOptimizer(learning_rate, beta1).minimize(g_loss, var_list=g_vars)
return d_train_opt, g_train_opt
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_opt(model_opt, tf)
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import numpy as np
def show_generator_output(sess, n_images, input_z, out_channel_dim, image_mode):
"""
Show example output for the generator
:param sess: TensorFlow session
:param n_images: Number of Images to display
:param input_z: Input Z Tensor
:param out_channel_dim: The number of channels in the output image
:param image_mode: The mode to use for images ("RGB" or "L")
"""
cmap = None if image_mode == 'RGB' else 'gray'
z_dim = input_z.get_shape().as_list()[-1]
example_z = np.random.uniform(-1, 1, size=[n_images, z_dim])
samples = sess.run(
generator(input_z, out_channel_dim, False),
feed_dict={input_z: example_z})
images_grid = helper.images_square_grid(samples, image_mode)
pyplot.imshow(images_grid, cmap=cmap)
pyplot.show()
Implement train
to build and train the GANs. Use the following functions you implemented:
model_inputs(image_width, image_height, image_channels, z_dim)
model_loss(input_real, input_z, out_channel_dim)
model_opt(d_loss, g_loss, learning_rate, beta1)
Use the show_generator_output
to show generator
output while you train. Running show_generator_output
for every batch will drastically increase training time and increase the size of the notebook. It's recommended to print the generator
output every 100 batches.
def train(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode):
"""
Train the GAN
:param epoch_count: Number of epochs
:param batch_size: Batch Size
:param z_dim: Z dimension
:param learning_rate: Learning Rate
:param beta1: The exponential decay rate for the 1st moment in the optimizer
:param get_batches: Function to get batches
:param data_shape: Shape of the data
:param data_image_mode: The image mode to use for images ("RGB" or "L")
"""
# TODO: Build Model
step = 0
real_input, z_data, lr = model_inputs(data_shape[1], data_shape[2], data_shape[3], z_dim)
d_loss, g_loss = model_loss(real_input, z_data, data_shape[3])
d_opt, g_opt = model_opt(d_loss, g_loss, learning_rate, beta1)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for epoch_i in range(epoch_count):
for batch_images in get_batches(batch_size):
# TODO: Train Model
batch_images = batch_images.reshape(batch_size, data_shape[1], data_shape[2], data_shape[3])
batch_images *= 2
step += 1
# Sample random noise for G
batch_z = np.random.uniform(-1, 1, size=(batch_size, z_dim))
# Run optimizers twice
_ = sess.run(d_opt, feed_dict={real_input:batch_images, z_data:batch_z, lr: learning_rate})
_ = sess.run(g_opt, feed_dict={real_input:batch_images, z_data:batch_z, lr: learning_rate})
_ = sess.run(d_opt, feed_dict={real_input:batch_images, z_data:batch_z, lr: learning_rate})
_ = sess.run(g_opt, feed_dict={real_input:batch_images, z_data:batch_z, lr: learning_rate})
# At the end of each epoch, get the losses and print them out
if step % 10 == 0:
train_loss_d = d_loss.eval({z_data: batch_z, real_input: batch_images})
train_loss_g = g_loss.eval({z_data: batch_z})
print("Epoch {}/{}...".format(epoch_i+1, epoch_count),
"Discriminator Loss: {:.4f}...".format(train_loss_d),
"Generator Loss: {:.4f}".format(train_loss_g))
if step % 100 ==0:
show_generator_output(sess, 20, z_data, data_shape[3], data_image_mode)
Test your GANs architecture on MNIST. After 2 epochs, the GANs should be able to generate images that look like handwritten digits. Make sure the loss of the generator is lower than the loss of the discriminator or close to 0.
batch_size = 32
z_dim = 128
learning_rate = 0.0002
beta1 = 0.5
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 2
mnist_dataset = helper.Dataset('mnist', glob(os.path.join(data_dir, 'mnist/*.jpg')))
with tf.Graph().as_default():
train(epochs, batch_size, z_dim, learning_rate, beta1, mnist_dataset.get_batches,
mnist_dataset.shape, mnist_dataset.image_mode)
Run your GANs on CelebA. It will take around 20 minutes on the average GPU to run one epoch. You can run the whole epoch or stop when it starts to generate realistic faces.
batch_size = 64
z_dim = 128
learning_rate = 0.001
beta1 = 0.1
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 1
celeba_dataset = helper.Dataset('celeba', glob(os.path.join(data_dir, 'img_align_celeba/*.jpg')))
with tf.Graph().as_default():
train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches,
celeba_dataset.shape, celeba_dataset.image_mode)
When submitting this project, make sure to run all the cells before saving the notebook. Save the notebook file as "dlnd_face_generation.ipynb" and save it as a HTML file under "File" -> "Download as". Include the "helper.py" and "problem_unittests.py" files in your submission.


THE TINNER OF CHYANNOR [a]
THE village of Trereen, near the Logan Stone, was at one time an important market-town. Here came all the tin-streamers who worked from Penberth to the hills, and to protect the place and the valuable property which was accumulated here, Castle Trereen was built. Here came-- or rather into the cove near it came--the Tyrian merchants. They were not allowed to advance beyond the shores, lest they should discover the country from which the tin was brought. But it is not of them that we have now to tell, but of a knot of tinners who came from the low country between Chyannor and Trengothal. These were assembled round the Garrack Zans, which then stood in the centre of the market-place of Trereen. Times had been bad, and they were consulting together what they had better do. The "streams" had failed them, and they believed all the tin was worked out. Some of them had heard that there was tin in "the country a long way off." some miles beyond Market-Jew; but they had but a very dim idea of the place or of the people. One of them, who, though an old man, was more adventurous than any of his comrades, said he would travel there and see what could be done. It was then determined that Tom Trezidder should try his fortune, and the others would wait until he came home again, or sent for them to come to him. This was soon noised about, and all the women, old and young, came to say" Good-bye" to Tom. His parting with his wife was brief but bitter. He bore up well, and with a stout heart started on his adventure. Tom Trezidder arrived at length at a place not far from Goldsythney, and here he found one of the Jew merchants, who farmed the tin ground, and sold the tin at St Michael's Mount; and the Jew was very anxious to engage so experienced a "streamer" as Tom was. Tom, nothing loath, took service for a year. He was to have just enough to live on, and a share of profits at the year's end. Tom worked diligently, and plenty of tin was the result of his experienced labour. The year expired, and Tom looked for his share of the profits. The Jew contrived to put Tom off, and promised Tom great things if he would stop for another year, and persuaded him to send for some of his old comrades, clenching every argument which he employed with a small piece of advice, "Never leave an old road for a new one,"
The other tiriners were shy of venturing so far, so that two or three only could be persuaded to leave the West Country. With Tom and with his brethren the year passed by, and at the end he got no money, but only the same piece of advice, "Never leave an old road for a new one." This went on for a third year, when all of them, being naturally tired of this sort of thing, resolved to go home again.
Tom Trezidder was a favourite with his master, and was greatly esteemed for his honesty and industry by his mistress.
When they left she gave Tom a good currant cake to take home to his old woman, and told him to remember the advice, "Never leave an old road for a new one."
The tinners trudged on together until they were on the western side of Penzance. They were weary, and they found that since they had left home a new road had been made over the hills, which saved them a considerable distance--in fact it was a "short cut." On they went. "No," says Tom; "never leave an old road for a new one." They all laughed at him, and trudged on. But Tom kept in the old road along the valley round the hill. When Torn reached the other end of the "short cut" he thought he would rest a bit, and he sat down by the road-side and ate his fuggan. This his mistress had given him, that he might not break his cake until he got home.
He had not sat long when he heard a noise, and, looking up the hill, he saw his comrades, who he thought were miles in advance of him, slowly and sorrowfully descending it. They came at last to where Tom was seated, and a sad tale had they to tell, They had scarcely got into the new road when they were set upon by robbers, who took from them "all their little bit of money," and then beat them because they had no more.
Tom, you may be sure, thought the piece of advice worth something now, as it had saved his bacon.
Tom arrived home at last, and glad was the old woman to see her old man once again; so she made him some "herby tea" at once. He showed his wife the cake, and told her that all he had received for his share of profits was the piece of advice already given.
The ladies who read this story will understand how vexed was Tom's wife,--there are but few of them who would not have done as she did, that was to seize the cake from the table and fling it at her husband's head, calling him an old fool. Tom Trezidder stooped to avoid the blow. Slap against the corner of the dresser went the cake, breaking in pieces with the blow, and out on the lime-ash floor rolled a lot of gold coins.
This soon changed the aspect of things; the storm rolled back, and sunshine was once more in the cottage. The coins were all gathered up, and they found a scrap of paper, on which, when they got the priest to read it, they discovered was written an exact account of each year's profits, and Tom's share. The three years' shares had been duly hoarded for him by his master and mistress; and now this old couple found they had enough to make them comfortable for the rest of their days. Many were the prayers said by Tom and his wife for the happiness and health of the honest Jew tin merchant and his wife.
[a] See Appendix BB.


The input Element
First name:
Choose a car:
Volvo
Saab
Fiat
Audi
The cat was playing in the garden.
Click Me!
Personalia:
First name:
Last name:
range.html
Input Sample
Input Attribute
Username:
Password:


Allows you to hide columns from active view, but still give users the ability to toggle this column on or off via a context menu.
(boolean)
: Defaulttrue
.
{visible: false}
Right-click anywhere on the grid and choose "Columns" to see the list of visible and invisible columns.


I’m a little behind the times in blogging about this, but I needed to actually have a blog first. Rumors have been flying for a while that Google was planning to release its own IM service, and now Google Talk is here. It is based on the Jabber XMPP protocol, but it isn’t yet linked into the Jabber server network.
You won’t find any fancy features in the minimalist client program, but that can sometimes be a good thing as it seems to use far fewer system resources than most other clients. If you want a more feature-rich client, you should be able to connect with any client that supports Jabber. You’ll also need to use a different client if you are not running on Windows, because the Google Talk client is currently a Windows-only application.
Currently, you can only chat with other Google Talk users, although Google promises that they are committed to interoperability. Unfortunately, I don’t know of any friends that are on Google Talk yet, so I can’t give it a thorough test in daily use.


Welcome to RideNeutral
Now let's take a look at what all those Uber rides have cost you, and the planet.
Continue


RemzTheDeveloper
Home
Portfolio
(current)
Services
Request A Proposal
MY PORTFOLIO
Scroll down for some samples of my work from concepts to products.
Ask For A Quote!
Kickstart Riding & Driving School


Drop down menu
Menu Item 1
Menu Item 2
Click outsides will be ignored in here
Button is excluded as well
This is not excluded and will register as a click outside of the menu


Zac Efron and Vanessa Hudgens attend Ashley Tisdale's birthday party in October 2005. The two began dating the same year while filiming "High School
Information, facts, data and trivia about Ashley Tisdale. Ashley shares a birthday with teen actress and singer, Lindsay Lohan. Andrew was also the voice of Zac Efron who was. Troy Bolton in Disney Channel's Original Besides chilling with her castmates on and off sets, Ashley got to attend exciting premiers and
May 21, 2013 Ashley Tisdale, who shot to fame alongside vanessa Hudgens and. Zac Efron in Disney's High School Musical franchise, Judi Dench 'Forced Herself To Recover' After Knee Operation To Attend Philomena Premiere. Wayne Rooney Is Criticised For Drinking £2,000 Bottle Of Wine With His Birthday Cake. Aug 7, 2013. Ashley Tisdale and rocker boyfriend Christopher French walked hand in hand. as they left a friend's birthday party in Los Angeles on Monday Zac Efron & Lily Collins Hold Hands at Disneyland! Exclusive: Demi Lovato and
Zac Efron's publicist is refusing to comment on swirling rumours the actor. Ashley Tisdale attended "The Lucky One" premiere in Los Angeles yesterday at a birthday party for Ashley Tisdale's sister Jennifer at Los Angeles' Lexington Social
Jul 4, 2011 Ashley Tisdale's Beach Birthday Bash With Zac Efron! 4 generations of royals attend Prince George's baptism in London · 'American Idol' Apr 17, 2012 The main reason Ash attended the. evening's festivities? Remember when they hit the beach last summer for Ashley's birthday? zac & ashley's frolic on the beach! Zac Efron & Ashley Tisdale Hit the Beach. Are you loving Jul 3, 2012 Check out Ashley Tisdale's birthday bikini beach celebration, with pals Selena Gomez and Vanessa Hudgens on the guest list Zac Efron Holds Hands With Lily Collins at Miley Cyrus Is Going To Regret Her Latest Tattoo.
Jul 4, 2011. Zac Efron and Ashley Tisdale got tongues wagging yesterday when the Liza Minnelli and Myleene Klass attend the Silver Clef Awards 12:05PM. in the surf on Saturday at Ashley's 26th birthday beach bash - although
Apr 18, 2012 Old pal Ashley Tisdale from High School Musical also attended the premiere to support the movie Watch Zac Efron's Face. Morph From Baby Zac Efron is a Disney star. from High School Musical Birth Date:. According to a report, Vanessa Hudgens, Ashley. Tisdale, Corbin Bleu, Lucas Grabeel, will all attend a private party to support Monique. Coleman's GimmeMo' Foundation Aug 5, 2013 She famously dated her High School Musical co-star Zac Efron But opening up to her best friend Ashley Tisdale in new E! interview, Vanessa. when your best friend is asking the questions, she's going to get a real answer. ' Sleepy Kanye West takes a nap during fiancee Kim Kardashian's birthday Ashley Tisdale , Zac Efron , Corbin. Blue , Vanessa Hudgens , Lucas Vanessa Hudgens, Ashley Tisdale, Lucas. Grabeel and Corbin Bleu attended the Ashley Tisdale Celebrating Her 27th Birthday On The Malibu Beach With Friends.


Event Processing Platform
Automate your Apps
We automate your various apps so you don't have to do it
Register an Account
Name
Email address
Password
Confirm password
Register
Already a user? Click here to Login
Incorrect Details
×
Password does not match


{%- assign item = include.item -%}
{% if item.start_reading %}
{%- if item.end_reading -%}
{%- assign sensibility = 0.99 -%}
{%- assign year = item.start_reading | date: "%Y" -%}
{%- assign year_start = year | prepend: "01-01-" | date: "%s" | divided_by: sensibility -%}
{%- assign year_end = year | prepend: "31-12-" | date: "%s" | divided_by: sensibility -%}
{%- assign start_unix = item.start_reading | date: "%s" | divided_by: sensibility -%}
{%- assign end_unix = item.end_reading | date: "%s" | divided_by: sensibility -%}
{%- if end_unix > year_end -%}
{%- assign end_graph = year_end -%}
{%- else -%}
{%- assign end_graph = end_unix -%}
{%- endif -%}
{%- assign reading_time = end_unix | minus: start_unix | plus: year_start -%}
{%- assign reading_graph = end_graph | minus: start_unix | plus: year_start -%}
{% capture span_date %}{% include filters/condensed_date.html start=item.start_reading end=item.end_reading %}{% endcapture %}
{%- assign label = reading_time | minus: year_start | divided_by: 86400.0 | round | append: " days: " | append: span_date -%}
{%- include simulibros/progress.html min=year_start max=year_end now=reading_graph offset=start_unix tooltip=label -%}
{%- else -%}
Reading since {{ item.start_reading | date: "%-d %b %Y" }}
{%- endif -%}
{% endif %}


Any item that restores an amount of Mana a character has, or restores uses of spells (in the case of Vancian Magic) and special attacks.
The amount can vary, from just a fraction of a Mana Meter or one use of a low level spell, to restoring all the magic points or restoring all uses of every level spell. If there is a range of these items, the lower level restoring ones will cost less and be more plentiful in Treasure Chests and Random Item Dropping (although in most games, healing items of the same level tend to be more common).
Obviously absent in cases when there is no Mana Meter and spells simply need material components to cast. In some settings, however, mana potions are specifically necessary as a component to cast spells, because reserves of mana have to be acquired rather than generated naturally.
Unlike said healing potions which can be red or green, mana potions are nearly universally Color-Coded for Your Convenience in blue.
Also note that Trauma Inns, Healing Springs, and Healing Checkpoints often restore magic as well as health.
A Sub-Trope of Standard RPG Items.
A Sister Trope to Regenerating Mana, Healing Potion (restores the Life Meter), Panacea (heals disease and status).
Examples
- In Delicious in Dungeon, Marcille drinks soup made from an undine (a type of water spirit) to restore her depleted mana.
- When Fujimoto is trying to contain Ponyo inside a bubble, he says he needs more power and has to start drinking elixirs from several long-necked bottles before he can manage it.
- Dungeons & Dragons: Once per day, a Pearl of Power can restore one cast spell of a specific Spell Level to a Vancian Magic user.
- Pathfinder: As in Dungeons & Dragons, a Pearl of Power can restore a cast spell of a specific Spell Level to a Vancian Magic user once per day.
- Princess: The Hopeful has Seeds, crystallized Wisps of Light that Princesses can reclaim to replenish their Wisp pool in a hurry.
- Present in Artix Entertainment's AdventureQuest, DragonFable, and AdventureQuest Worlds. Of course, this being Artix Entertainment, it's frequently Lampshaded and Played for Laughs.
- The Final Fantasy games restore magic with the item "Ether", and the more powerful "X-Ether". Some games have other variants as well.
- The "Mana Prism", in some Castlevania games, restores all magic.
- In some games, hearts restores magic instead of adding ammo to the sub weapons. These games include both Castlevania: Chronicles of Sorrow games, and Castlevania: Portrait of Ruin.
- Divinity: Original Sin II: Source Orbs can be consumed by a character to restore a point of Source, which fuels their most powerful skills. Outside this restriction, skills function independently on a Cooldown system.
- The Elder Scrolls:
- The series has ubiquitous, typically blue potions that restore a set amount of Magicka points.  They're a must-have for any magic-oriented Player Characters.
- The Elder Scrolls IV: Oblivion introduces Welkynd Stones, a Limited-Use Magical Device infused with Star Power that completely refills the character's Magicka meter when used. They're also present in The Elder Scrolls V: Skyrim as rare curios.
- In The Legend of Zelda games that use magic, a green potion restores magic, and a blue potion restores life and magic. Enemies also drop bottle-shaped items that restore magic.
- In Zelda II: The Adventure of Link, enemies would drop a blue bottle that restores some magic, and a red bottle that restores all of it. Some red potions were in fixed locations, such as statues that needed to be slashed to drop them.
- In Gobli's Adventure, the sample game that came with the Playstation version of RPG Maker, Blue Berries serve this role to Red Berries' Healing Potion.
- Blackberries are the most common example of this in the Star Ocean series, but various other potions and food and drink also serve this role.
- In Ōkami and the sequel, ink pots refill your ink, which function like a Mana Meter.
- In Fortune Summoners, 'magic candy' refills your MP.
- In some Kingdom Hearts, games, enemies can drop balls that restore MP. That is in addition to the Ether potions crossed over from the Final Fantasy series. In games that don't have MP, but still have some form of ability meter, Ether is instead used to heal that.
- In Crystalis, the Fruit of Power restores some MP, the Magic Ring restores all of it, and Deo's Pendant gradually restores MP if equipped and the player stands still.
- Dubloon features alcohol beverages as items replenishing your alcohol points needed to cast magic.
- In Super Mario RPG, and the subsequent Mario RPG games, Syrups restore flower points.
- In the Disgaea games, drinks restore MP.
- In Wild AR Ms 1, a Magic Carrot restores MP (later games had you build up magic).
- In some Phantasy Star games, Fluids restore MP.
- Dungeons & Dragons Online has the rather expensive Potions of Mnemonic Enhancement, which restore your Spell Points.
- Nox had regular mana potions but also "mana stones": stationary glowing pillars that quickly restored your mana if you stood nearby. Particularly when playing as wizard, controlling large conglomerations of mana stones was essential to winning long battles.
- During the Fade sections in the Dragon Age series, you often encounter lyrium outcroppings that instantly restore your mana to full. The game also has lyrium potions of various qualities that you can loot or craft the do the same. (Thankfully, although the lore of the game states that lyrium in any form is highly addictive to anyone except dwarves, this does not apply to you in gameplay!)
- Wizardry has Magicfood effect — in VII, it's Golden Apples (1), Moser's Mojo Tea (2), Bottle of Old Jake's (4), Mana Stone (6), Milk of Magmanasia (6) and Stave of 12 Stars (level 6, x12 charges).
- Diablo
- Mana Potions restored your character's mana.
- Magical weapons could have a special ability that restored your mana when they hit an opponent.
- Breath of Fire 3: Equipping an item that reduces AP cost and using transfer on yourself actually heals your MP.
- in Pokémon games, you can find various kinds of Ethers and Elixirs in item balls. Ethers restore part of a move's PP, while Max Ethers restore all of it. Elixirs and Max Elixirs restore some and all PP to all moves, respectively. Especially handy for the Elite Four, and you can't buy them in the shops. Most games since the third let you grow Leppa berries, which do the same thing, making Ethers rather obsolete.
- The Dragon Quest series has vials of magic water that restore different amounts of MP. They're usually very rare and aren't sold in stores, often making them Too Awesome to Use. There's also the Prayer Ring, an equippable accessory that can be used as an item to recover MP. It can be used multiple times, but each use has a chance of randomly destroying it.
- Mana Leaves/Seeds/Roots/Extracts from the Shadow Hearts trilogy
- In first two BioShock games, this purpose is served by the EVE Hypos - though they're injectable, not drinkable. Consuming certain drinks or smoking will also restore small amounts of mana at the expense of health (although a certain Gene Tonic allows alcoholic drinks to restore EVE too). BioShock Infinite has Salts, though the name makes it unclear whether it's an inhalable or edible affair.
- Piero's Spiritual Remedy in Dishonored. Both this and its health potion counterpart are used by the population to protect against the plague that has stuck the game setting.
- Blue Potions and Blue Herbs, along with a few fruits, serve this purpose in Ragnarok Online. Like the Healing Potions, they can be crafted by all. The Alchemist class is also able to chuck them at allies.
- Terraria has four different levels of Mana Potion, each restoring increasing amounts of Mana. While you can guzzle them all day (and automatically so with the Mana Flower), drinking one imposes the Mana Sickness debuff, temporarily reducing your magic damage output.
- Blue vials and jars in Shovel Knight restore respectively 5 MP and 30 MP. In the Plague of Shadows scenario, potions simply charge up Plague Knight's power bar faster.
- Parasite Eve II has various types of items that recovers MP. Bottled mineral water restores a good chunk of your MP, cans of Coco-Cola restores 20 HP and 80 MP, using a Lipstick fully restores MP and boosts its max value by 1, and Ringer's Solutions restores your MP and HP to full.
- Bayonetta has the Purple Magic lollipops. The normal version replenishes 4 magic orbs, while the Mega Purple Magic lollipops restore 8 magic orbs (enough to automatically use a Torture Attack or an Umbran Climax in the sequel).
- The MP Candies are Miitopia's take on this trope, being the basic Magic-replenishing items. There are also MP sprinkles, which the player themselves can shower Mii with for the same effect.
- The Trails series has the EP Charge items, which usually come in three tiers.
- Radiant Historia has the Herbal/Special/Superior Tea, as well as the Celestial Tea/Oil/Dew (arranged by tier).
- Peter Jacob of Eternal Darkness can find a Magickal Elixir which completely restores his Mana Meter, with five doses available to him. Very useful, since his chapter concludes with a Wizard Duel.
- Shin Megami Tensei:
- Most games have "Chakra Drops" and "Chakra Pots" that restore a small amount of or all SP, respectively. In many games, they are surprisingly common random drops from random encounters.
- In Persona 5, the Hero lives at a café and can borrow the owner's coffee-making equipment. The resulting cup of coffee is the easiest-to-get SP-restoring item for most of the game, but making coffee takes up precious time in your schedule (it does advance Sojiro's Social Link, though).
- The Wolf And The Waves: Blue mushrooms will fully refill your Curse meter, letting you instantly shapeshift into a wolf.
- Cradle Series: Elixirs are a standard way of regenerating madra. However, they typically work too slowly to be useful in combat. Therefore, they are either used to help you recover faster after a fight, or to help you improve your core. An elixir gives you more madra than you could typically hold, you cycle it through your body, and your core gets stretched a little. Doing it too much can be dangerous, and elixirs are expensive, but it's generally faster than cycling aura.
- The Dresden Files introduced something that functioned somewhat like this in the second book in the series. It came with a major drawback: It doesn't actually restore Harry's reserves of magical power so much as suppress the symptoms of magical exhaustion... for a while, and he really pays for it when it wears off, which happens at an extremely bad time.
- A Mage's Power: If a mage needs a boost in a hurry, they can down a bottle of Mana Juice! Available at your local convenience store
- Tass in morphE, it tastes great mixed in with tea.


K's Boba Shop
Home
Boba Teas
Snack Menu
Contact
Gallery
Career
Snack Menu
French Fries $3.50
Loaded Chili Fries $6.50
Cheese Fries with Hot Cheetos $5.50
Sweet Potato Fries $3.50
Chicken Fingers $4.75
Popcorn Shrimp $5.50


John
Date of Birth : 04 Jan 1962
SSN :909878909
Relationship :Non-Spouse
Graham
Date of Birth : 04 Feb 1958
SSN :909878932


This article targets anyone with previous exposure to machine learning but with little to no knowledge of the recommendation systems. However, it is highly probable that anyone interested in this work interacts with a recommender system regularly. Anyone who listens to Spotify or watches movies on Netflix benefits from the rigorous algorithms (recommendation systems) developed by teams of data scientists and software engineers. The theoretical part of the article explains the fundamentals of various recommendation systems. The practical section emphasizes practical usage of collaborative filtering while utilizing Surprise package and movie-lense data set. Specifically, the author creates two recommender systems utilizing i.) Singular Value Decomposition (SVD), ii.) Non-negative Matrix Factorization (NMF). Both models evaluate/determine users' preferences based on principles of linear algebra.
Theoretical Part
Basics of The Recommender System
The reason why consumers need reliable recommendations is straightforward: Given the availability of almost unlimited number of choices (e.g. different movie genres of various quality), and the natural tendency of human is to maximize his/her utility, the user needs guidance to the next best item that accommodates his/her needs or preferences. Specifically, Netflix has become so popular because of its capability to suggest the user a next movie (from thousands of other options) that matches to the best of user's taste.
Types of the Systems
There are many ways and complex algorithms used to build a recommender system. The following are fundamental approaches. While reading, the reader should think which one may be the most effective method when it comes to a movie recommendation.
The Most Popular Item: It is the simplest strategy and requires no coding skills. It works based on the assumption that the most popular item attracts most consumers or most users. For example, any consumer shopping on Amazon would see the most frequently bought items. Conversely, Netflix would recommend every user the most popular movie in its list.
Association & Market Based Model: The system makes recommendations based on the items in the consumer's basket. For instance, if the system detected that the buyer is purchasing ground coffee it would also suggest her to buy filters as well (observed association coffee - filters).
Content Filtering: Uses metadata to determine the user's taste. For example, the system recommends the user movies based on their preferences of genres, actors, themes, etc. Such a system matches the user and the item based on similarity. For example, if the user watched and liked Terminator and Predator (both action movies with Arnold Schwarzenegger in the main role), it would probably recommend them to watch Commando.
Collaborative Filtering (CF): It is an algorithmic architecture that recommends consumers items based on their observed behavior. There are two types of Collaborative Filtering frameworks: Model-Based Approach and Memory-Based Approach:
- User-based (UBCF): It is a predecessor of Item-based CF. UBCF makes recommendations based on the user's characteristics that are similar to other users in the system. For example, if the end-user positively rates a movie, the algorithm finds other users who have previously rated the movie too, i.e. these users are similar to one another. In the next step, the system recommends the user an unseen movie but highly rated by other - referenced - users. See Figure 1.
Item-based (IBCF): IBCF was originally developed by Amazon and is currently adopted by most online corporations (e.g. Netflix, YouTube, etc.).
Hybrid Models: As the name suggests, the Hybrid Models combine two or more recommendation strategies. For instance, a Hybrid Content-Collaborative System can recommend the user a movie based on their gender but still focuses on the movie features the user exhibits to prefer.
While Hybrid Models logically appear to be the most effective ones, Netflix's recommendation engine is based on the assumption that similar users like and dislike similar items; i.e. Collaborative Filtering is the key to Netflix's success.
Both the SVD and NMF models trained in the article are classified as IBCF. Note that the performance of these models do not meet industry standards. With recent advances in deep learning, online users currently encounter recommendations trained with various types of (hybrid) neural networks (e.g. MLP, CN, RNN, etc.). If the reader is interested in a new perspective and the most advanced models used by the giant online corporations, Deep Learning based Recommender System: A Survey and New Perspectives by Zhang et al. provides a complex overview of up-to-date development in this field.
User-based (UBCF)
Figure 1 demonstrates how the UBCF works when the system identifies similar users (the reference group) to the end-user. Again, to explain exactly how the recommender system evaluates/determines the user's taste, one should recall the assumption that similar users exhibit similar preferences. Precisely, that is how the reference group is determined; i.e. both the user and group share a history of rating similar items. The author of this article describes the similarity as "empirical" because the similarity is observable in data. In the next step, the system allocates the only items the reference group had previously been exposed to and recommends the end-user items with the highest predicted rating.
Issues with UBCF
Even though CF is powerful, there are few challenges. Like other researchers, Sarwar et al. (2001) state that scalability and sparsity are the primary issues.
Scalability: In a system where there are many new users, i.e. users with low records of ratings, it is computationally expensive to train the model. A typical example would be a web-based application with a recommender system incorporating millions of users and items. Such problems arise with Nearest Neighbour algorithms in UBCF where such algorithms require computations that grow simultaneously with the increasing numbers of users and items.
Sparsity arises in a system when even the most active users have rated or purchased only a marginal number of available items. For example, these users may have experience with even less than 1% of available items.
If a recommender system experiences either one or both of the described issues, the algorithm's performance decreases; i.e. the system does not recommend the user relevant items (Sarwar et al.,2001). Consequently, the user does not trust the recommendations.
Item-based (IBCF)
To tackle the issues with UBCF, item-based collaborative techniques analyze the user-item matrix and identify relationships between different items (Sarwar et al.,2001). The item-based recommendation system then makes recommendations based on the discovered linear relationships (similarities) amongst the items.
Collaborative Filtering: Model-Based Approach
Once again, this article discusses Collaborative Item-based Filtering and focuses on the Model-Based Approach which tackles the two challenges imposed by CF. Unlike Memory-Based Approach, Model-Based procedure facilitates machine learning techniques such as Singular Value Decomposition (SVD) and Matrix Factorization models to predict the end user's rating on unrated items. In the context of a movie-to-movie recommender, a collaborative filter answers the question: “What movies have a similar user-rating profile?"(Lineberry & Longo, 2018).
Importing Packages and Data
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from collections import defaultdict #data colector
#Surprise: https://surprise.readthedocs.io/en/stable/
import surprise
from surprise.reader import Reader
from surprise import Dataset
from surprise.model_selection import GridSearchCV
##CrossValidation
from surprise.model_selection import cross_validate
##Matrix Factorization Algorithms
from surprise import SVD
from surprise import NMF
np.random.seed(42) # replicating results
Importing Online Data
MovieLens provides available rating datasets from the MovieLens web site (F. M. Harper and J. A. Konstan, 2015). Any machine learning practitioner may use several different rating files with a number of rated movies and the time of release. For demonstrative purposes and limited computation power, the author worked with 100,836 ratings and 3,683 tag applications across 9,742 movies. The full description of the particular dataset can be found here. According to the documentation, the selected users in data rated at least 20 movies on the scale from 0.5 to 5. The dataset was last updated on 9/2018
The work considers only tidy data in ratings.csv
and movies.csv
.
Specifically, ratings_df
records userId
, movieId
, and rating
consecutively.
On the other hand, movies_df
stores values in movieId
and genres
. movieId
is, therefore, the mutual variable.
Note that Surprise
enables one to upload data, e.g. csv files, for predictions through its own methods. On the other hand, as it is discussed below, Surprise
also allows the user to use pandas' DataFrames. The author works with pd.DataFrame
objects for convenience.
from io import BytesIO
from zipfile import ZipFile
from urllib.request import urlopen
r = urlopen("http://files.grouplens.org/datasets/movielens/ml-latest-small.zip")
zipfile = ZipFile(BytesIO(r.read()))
#print the content of zipfile
zipfile.namelist()
['ml-latest-small/',
'ml-latest-small/links.csv',
'ml-latest-small/tags.csv',
'ml-latest-small/ratings.csv',
'ml-latest-small/README.txt',
'ml-latest-small/movies.csv']
# tidy df ratings (movieId,)
ratings_df = pd.read_csv(zipfile.open('ml-latest-small/ratings.csv'))
print('Columns of ratings_df: {0}'.format(ratings_df.columns))
#movies df (tidy data)
movies_df = pd.read_csv(zipfile.open('ml-latest-small/movies.csv'))
print('Columns of movies_df: {0}'.format(movies_df.columns))
Columns of ratings_df: Index(['userId', 'movieId', 'rating', 'timestamp'], dtype='object')
Columns of movies_df: Index(['movieId', 'title', 'genres'], dtype='object')
Inspecting the Data
One of the advantages of training on the selected dataset is its purity. Unlike in the real world, one does not need to spend extra time on data cleansing. The following chunk's output demonstrates how the data is stored. The results are in line with the disclosed data description.
#ratings
print(ratings_df.head())
print(ratings_df.info())
print(ratings_df.describe())
userId movieId rating timestamp
0 1 1 4.0 964982703
1 1 3 4.0 964981247
2 1 6 4.0 964982224
3 1 47 5.0 964983815
4 1 50 5.0 964982931
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100836 entries, 0 to 100835
Data columns (total 4 columns):
userId 100836 non-null int64
movieId 100836 non-null int64
rating 100836 non-null float64
timestamp 100836 non-null int64
dtypes: float64(1), int64(3)
memory usage: 3.1 MB
None
userId movieId rating timestamp
count<PHONE_NUMBER>00<PHONE_NUMBER>00<PHONE_NUMBER>00 1.008360e+05
mean 326.127564 19435.295718 3.501557 1.205946e+09
std 182.618491 35530.987199 1.042529 2.162610e+08
min 1.000000 1.000000 0.500000 8.281246e+08
25% 177.000000 1199.000000 3.000000 1.019124e+09
50% 325.000000 2991.000000 3.500000 1.186087e+09
75% 477.000000 8122.000000 4.000000 1.435994e+09
max 610.000000<PHONE_NUMBER>00 5.000000 1.537799e+09
#movies
print(movies_df.head())
movieId ... genres
0 1 ... Adventure|Animation|Children|Comedy|Fantasy
1 2 ... Adventure|Children|Fantasy
2 3 ... Comedy|Romance
3 4 ... Comedy|Drama|Romance
4 5 ... Comedy
[5 rows x 3 columns]
Note that movies_df
contains only movieId
and genres
variables which store even multiple genres separated by the vertical bar in one cell.
Data Pre-Processing
Filtering Data Set
Firstly, it is essential to filter out movies and users with low exposure to remove some of the noise from outliers. According to the official MovieLens documentation, all selected users have rated at least 20 movies in the data set. However, the following code filters out the movies and users based on an arbitrary threshold and creates a new data frame ratings_flrd_df
. Moreover, the chunk also prints the value of deleted movies with new and old dimensions.
min_movie_ratings = 2 #a movie has was rated at least
min_user_ratings = 5 #a user rated movies at least
ratings_flrd_df = ratings_df.groupby("movieId").filter(lambda x: x['movieId'].count() >= min_movie_ratings)
ratings_flrd_df = ratings_flrd_df.groupby("userId").filter(lambda x: x['userId'].count() >= min_user_ratings)
"{0} movies deleted; all movies are now rated at least: {1} times. Old dimensions: {2}; New dimensions: {3}"\
.format(len(ratings_df.movieId.value_counts()) - len(ratings_flrd_df.movieId.value_counts())\
,min_movie_ratings,ratings_df.shape, ratings_flrd_df.shape )
'3446 movies deleted; all movies are now rated at least: 2 times. Old dimensions: (100836, 4); New dimensions: (97390, 4)'
Data Loading
While using Surprise
, one can use a bunch of built-in datasets (e.g. Jeseter or even the movielens) parsed by Dataset
module. However, it is usually required to build a customized recommender system. In a case as such, it is necessary to upload your own rating dataset either from a file (e.g. csv) or from a pandas' dataframe. In both cases, you need to define a Reader
object to parse the file or the dataframe by Surprise
. See the reference here.
In the next step, one must load the data set through the call of a particular method of surprise.Dataset
. Specifically, load_from_file()
loads a csv file. Surprise also allows to upload pandas' DataFrame
. This time, it is required to upload the data frame with ratings by user per movie (i.e. in the tidy format) with Dataset.load_from_df
and specify reader
as the argument.
Lastly, build_full_trainset()
method builds the training set from the entire data set. As demonstrated later, training on the whole data while using the best hyper tuning parameters is useful for the prediction of top arbitrary number of movies for each userId
.
reader = Reader(rating_scale=(0.5, 5)) #line_format by default order of the fields
data = Dataset.load_from_df(ratings_flrd_df[["userId", "movieId", "rating"]], reader=reader)
trainset = data.build_full_trainset()
testset = trainset.build_anti_testset()
The following sections aim to explain particular methods of matrix factorization. Since SVD is the first model to be examined, the scope differs a little. To avoid copy-pasting long chunks of code, the author defines and explains two useful generic functions for a.) performance evaluation and b.) predictions.
Matrix Factorization
Hopcroft and Kannan (2012), explains the whole concept of matrix factorization on customer data where m customers buy n products. The authors explain collaborative filtering in a comprehensive language. For demonstrative purposes, the author of this article demonstrates the concept on a specific case.
Let matrix \(R_{m*n}\) represent the ratings on movies assigned by each user, also called the utility matrix. Specifically, the value $r_{ij}=5$ represents the rating of user i assigned to movie j. However, the individual's preference is determined by k factors. For example, the user's age, sex, income, education, etc. are likely to affect the user's behavior. Accordingly, the individual's rating of a movie ($r_{ij}$) is determined by some weighted combinations of the hidden factors. In practice, customer's behavior can be characterized by a k-dimensional vector with much lower dimensions than the original matrix $R$ with $m * n$ dimensions. The vector's components, also called the latent factors, represent the weight of each factor. For example, given a vector $v_2 = [0.2 , 0.8]$ it can be hypothesized that there are only two (unknown) latent factors with subsequent weights describing the rating (behavior).
Matrix factorization is an effective CF technique because it benefits from the properties of linear algebra. Specifically, consider matrix $R$ as a record of various elements. As it is possible to decompose any integer into the product of its prime factor, matrix factorization also enables humans to explore information about matrices and their functional properties an array of elements (Goodfellow, Bengio, 2016)
Singular Value Decomposition (SVD)
SVD decomposes any matrix into singular vectors and singular values. If the reader has previous experience with machine learning, particularly with dimensionality reduction, they would find traditional use of SVD in Principal Component Analysis (PCA). Simply put, SVD is equivalent to PCA after mean centering, i.e. shifting all data points so that their mean is on the origin (Gillis, 2014).
Formally, SVD is decomposition of a matrix R into the product of three matrices: \(R_{m*n} = U_{m*m} D_{m*n} V_{n*n}^{t}\).
Where \(R_{m*n}\) denotes the utility matrix with n equal to the number of e.g. users and m number exposed items (movies). $U_{m*m}$ is a left singular orthogonal matrix, representing the relationship between users and latent factors (Hopcroft & Kannan, 2012). \(D_{m*n}\) is a diagonal matrix (with positive real values) describing the strength of each latent factor. \(V_{n*n}^{t}\) (transpose) is a right singular orthogonal matrix, indicating the similarity between items and latent factors.
The general goal of SVD (and other matrix factorization methods) is to decompose the matrix R with all missing $r_{ij}$ and multiply its components \(U_{m*m} D_{m*n} V_{n*n}^{t}\) once again. As a result, there are no missing values $r_{ij}$ and it is possible to recommend each user movies (items) they have not seen or purchased yet. To better understand linear algebra behind SVD, one can watch Gilbert Strang's lecture on SVD for MIT OpenCourseWare on YouTube channel or visit refer to NIT Singular Value Decomposition (SVD) tutorial.
Number of Factors and RMSE
For the demonstrative purpose, let's examine the effect of number of latent factors k on the model's performance. Specifically, it is possible to visually observe the effect of multiple factors on error measurement. As in supervised machine learning, cross_validate
computes the error rate for each fold. The following function computes the average of RMSE given by the five folds and append the empty list rmse_svd
. Consequently, the list contains 100 measures of min RMSE given 100 consecutive values of k in each test set, and by five folds in every iteration.
def rmse_vs_factors(algorithm, data):
"""Returns: rmse_algorithm i.e. a list of mean RMSE of CV = 5 in cross_validate() for each factor k in range(1, 101, 1)
100 values
Arg: i.) algorithm = Matrix factoization algorithm, e.g SVD/NMF/PMF, ii.) data = surprise.dataset.DatasetAutoFolds
"""
rmse_algorithm = []
for k in range(1, 101, 1):
algo = algorithm(n_factors = k)
#["test_rmse"] is a numpy array with min accuracy value for each testset
loss_fce = cross_validate(algo, data, measures=['RMSE'], cv=5, verbose=False)["test_rmse"].mean()
rmse_algorithm.append(loss_fce)
return rmse_algorithm
0.0015829191458780407
rmse_svd = rmse_vs_factors(SVD,data)
To replicate the plot of performance for each subsequent model, the following chunk defines the function plot_rmse()
with two arguments where rmse
is a list of float values and algorithm
is an instantiated matrix factorization model. The function returns a plot with two line subplots that display performance vs. numbers of factors. The second subplot only zooms in and marks k with the best performance, i.e. the minimum RMSE.
def plot_rmse(rmse, algorithm):
"""Returns: sub plots (2x1) of rmse against number of factors.
Vertical line in the second subplot identifies the arg for minimum RMSE
Arg: i.) rmse = list of mean RMSE returned by rmse_vs_factors(), ii.) algorithm = STRING! of algo
"""
plt.figure(num=None, figsize=(11, 5), dpi=80, facecolor='w', edgecolor='k')
plt.subplot(2,1,1)
plt.plot(rmse)
plt.xlim(0,100)
plt.title("{0} Performance: RMSE Against Number of Factors".format(algorithm), size = 20 )
plt.ylabel("Mean RMSE (cv=5)")
plt.subplot(2,1,2)
plt.plot(rmse)
plt.xlim(0,50)
plt.xticks(np.arange(0, 52, step=2))
plt.xlabel("{0}(n_factor = k)".format(algorithm))
plt.ylabel("Mean RMSE (cv=5)")
plt.axvline(np.argmin(rmse), color = "r")
plot_rmse(rmse_svd,"SVD")
According to the figure, there is an increasing trend of worse performance with higher k. The lowest RMSE is achieved when $k=4$. However, it is worth mentioning that $k=14$ is also very close to the RMSE achieved with only 4 latent factors. Besides, the author argues that it is not probable that the user's taste (rating) is determined by such a low number of factors. On the other hand, the result suggests a range of values which can be used in GridSearchCV()
for parameter tunning.
GridsearchCV (Sample)
param_grid = {'n_factors': [4,6,9,11,14,18,29]}
gs = GridSearchCV(SVD, param_grid, measures=['rmse'], cv=5)
gs.fit(data)
# best RMSE score
print(gs.best_score['rmse'])
# combination of parameters that gave the best RMSE score
print(gs.best_params['rmse'])
0.8639552777419859
{'n_factors': 11}
To make the model generalizable, i.e. avoid over and underfitting, the grid algorithm finds n_factors = 11
optimal.
Training SVD Algorithm and Predictions
Next, SVD(n_factors = 11)
fits the model on trainset
. To predict values, i.e. ratings, for each empty element $a_{ij}$ in the utility matrix, it is essential to specify: a.) the users and b.) particular movies that are not in the trainset. build_anti_testset()
method of trainset
accomplishes the goal. It returns a list of ratings (testset
) that are not in the trainset or in the entire utility matrix $R$. Consequently, it is possible to use the fitted model and predict ratings for movies in testset
. algo_SVD.test(testset)
returns the list with predictions.
algo_SVD = SVD(n_factors = 11)
algo_SVD.fit(trainset)
# Predict ratings for all pairs (i,j) that are NOT in the training set.
testset = trainset.build_anti_testset()
predictions = algo_SVD.test(testset)
# subset of the list predictions
predictions[0:2]
[Prediction(uid=1, iid=318, r_ui=3.5110432282575212, est=5, details={'was_impossible': False}),
Prediction(uid=1, iid=1704, r_ui=3.5110432282575212, est=4.953822490465707, details={'was_impossible': False})]
Prediction and Historical Reference
As is mentioned above, the raw predictions are stored in a list. It would also be difficult to search for any userId
and predictions with meaningful information. For example, let's assume there are two goals: i.) suggest any userId
the top 10 unseen movies the person is likely to enjoy and ii.) recommend the user movies with titles and genres. Overall, it was the author's objective to define a function with the following properties:
Map the predictions to each user.
Return: i.) recommendations for any given
userId
and ii.) the user's historical ratingsReturn the above objects with specific reference to the movie and its genre in a readable format (i.e. tidy DataFrame)
The below function get_top_n()
accomplishes the goals. The function takes five arguments. Specifically, predictions
is the list with predictions (predictions = algo_SVD.test(testset)
) , userId
is an arbitrary user's id, movies_df
is DataFrame with title and genre to each movieId
, ratings_df
contains historical ratings, and n
specifies how many movies should be recommended to the user. By default, n
is set to 10.
get_top_n()
consists of two main parts:
Part I. comes from the official Surprise documentation. It maps the prediction to each user, sorts them in descending order, and returns the top n (by default 10) recommended movies for the userId
specified as the argument of the function.
Part II. was inspired by an article published by IVIDIA data scientist Nick Becker on his blog. It prints the total number of movies rated by the user. Then, it merges the DataFrame objects, i.e. history and predictions, on movieID
in movies_df
. Therefore, besides movieId
both objects consequently contain title
and genres
. One can then holistically evaluate the model's performance on an individual level because the function's output (data frames) allows to observing both the highest rated predictions and the highest rated movies in the past. It is assumed that high rated genres should correspond to the user's taste and are therefore expected to appear in the recommended movies as well.
def get_top_n(predictions, userId, movies_df, ratings_df, n = 10):
'''Return the top N (default) movieId for a user,.i.e. userID and history for comparisom
Args:
Returns:
'''
#Peart I.: Surprise docomuntation
#1. First map the predictions to each user.
top_n = defaultdict(list)
for uid, iid, true_r, est, _ in predictions:
top_n[uid].append((iid, est))
#2. Then sort the predictions for each user and retrieve the k highest ones.
for uid, user_ratings in top_n.items():
user_ratings.sort(key = lambda x: x[1], reverse = True)
top_n[uid] = user_ratings[: n ]
#Part II.: inspired by: https://beckernick.github.io/matrix-factorization-recommender/
#3. Tells how many movies the user has already rated
user_data = ratings_df[ratings_df.userId == (userId)]
print('User {0} has already rated {1} movies.'.format(userId, user_data.shape[0]))
#4. Data Frame with predictions.
preds_df = pd.DataFrame([(id, pair[0],pair[1]) for id, row in top_n.items() for pair in row],
columns=["userId" ,"movieId","rat_pred"])
#5. Return pred_usr, i.e. top N recommended movies with (merged) titles and genres.
pred_usr = preds_df[preds_df["userId"] == (userId)].merge(movies_df, how = 'left', left_on = 'movieId', right_on = 'movieId')
#6. Return hist_usr, i.e. top N historically rated movies with (merged) titles and genres for holistic evaluation
hist_usr = ratings_df[ratings_df.userId == (userId) ].sort_values("rating", ascending = False).merge\
(movies_df, how = 'left', left_on = 'movieId', right_on = 'movieId')
return hist_usr, pred_usr
SVD Recommendations
Since the model was properly trained, it is already possible to suggest any userID
n
movies at this stage. Additionally, based on the acquired predictions and defined get_top_n()
function it is reasonable to visually inspect the recommended movies and the user's highest rated movies in the past. For instance, let's assume the userId
124 wants to watch a movie at their earliest convenience but has no specific title in mind. On top of that, the movie database contains over 6,000 titles across multiple genres so the user would spend a lot of time researching for what movies are in line with respect to their specific preferences. The following code makes the user's choice much easier. After calling get_top_n()
function, it is immediately obvious the user 124 has already rated 50 movies.
hist_SVD_124, pred_SVD_124 = get_top_n(predictions, movies_df = movies_df, userId = 124, ratings_df = ratings_df)
To see the user's history, let's examine their top 15 highest rated movies. The ratings are in the range from 5 to 4.5. As the table below shows, the user 124 enjoys a wide range of genres. Specifically, the highest rated movies (rating 5) are mostly dramas. Additionally, the user has mostly rated comedies, thrillers, and action/adventure movies.
hist_SVD_124.head(15)
| userId | movieId | rating | title | genres | |
|---|---|---|---|---|---|
| 0 | 124 | 1358 | 5.0 | Sling Blade (1996) | Drama |
| 1 | 124 | 3949 | 5.0 | Requiem for a Dream (2000) | Drama |
| 2 | 124 | 7361 | 5.0 | Eternal Sunshine of the Spotless Mind (2004) | Drama|Romance|Sci-Fi |
| 3 | 124 | 6377 | 5.0 | Finding Nemo (2003) | Adventure|Animation|Children|Comedy |
| 4 | 124 | 2858 | 5.0 | American Beauty (1999) | Drama|Romance |
| 5 | 124 | 356 | 5.0 | Forrest Gump (1994) | Comedy|Drama|Romance|War |
| 6 | 124 | 608 | 5.0 | Fargo (1996) | Comedy|Crime|Drama|Thriller |
| 7 | 124 | 3252 | 4.5 | Scent of a Woman (1992) | Drama |
| 8 | 124 | 1210 | 4.5 | Star Wars: Episode VI - Return of the Jedi (1983) | Action|Adventure|Sci-Fi |
| 9 | 124 | 1196 | 4.5 | Star Wars: Episode V - The Empire Strikes Back... | Action|Adventure|Sci-Fi |
| 10 | 124 | 3328 | 4.5 | Ghost Dog: The Way of the Samurai (1999) | Crime|Drama |
| 11 | 124 | 1884 | 4.5 | Fear and Loathing in Las Vegas (1998) | Adventure|Comedy|Drama |
| 12 | 124 | 4226 | 4.5 | Memento (2000) | Mystery|Thriller |
| 13 | 124 | 3147 | 4.5 | Green Mile, The (1999) | Crime|Drama |
| 14 | 124 | 5608 | 4.5 | Das Experiment (Experiment, The) (2001) | Drama|Thriller |
When it comes to predictions, the outcome is stored in the same order and format as the user's history.
pred_SVD_124
| userId | movieId | rat_pred | title | genres | |
|---|---|---|---|---|---|
| 0 | 124 | 750 | 4.610126 | Dr. Strangelove or: How I Learned to Stop Worr... | Comedy|War |
| 1 | 124 | 1136 | 4.545477 | Monty Python and the Holy Grail (1975) | Adventure|Comedy|Fantasy |
| 2 | 124 | 904 | 4.541237 | Rear Window (1954) | Mystery|Thriller |
| 3 | 124 | 1208 | 4.537614 | Apocalypse Now (1979) | Action|Drama|War |
| 4 | 124 | 1204 | 4.535593 | Lawrence of Arabia (1962) | Adventure|Drama|War |
| 5 | 124 | 56782 | 4.517568 | There Will Be Blood (2007) | Drama|Western |
| 6 | 124 | 1225 | 4.513478 | Amadeus (1984) | Drama |
| 7 | 124 | 898 | 4.512611 | Philadelphia Story, The (1940) | Comedy|Drama|Romance |
| 8 | 124 | 2959 | 4.510696 | Fight Club (1999) | Action|Crime|Drama|Thriller |
| 9 | 124 | 2160 | 4.499703 | Rosemary's Baby (1968) | Drama|Horror|Thriller |
Comparing the predictions with history, one can observe that the genres are in line with the user's taste.
Non-Negative Matrix Factorization (NMF)
NMF is another method used for matrix factorization. Contrary to SVD, NMF decomposes the non-negative utility matrix R into the product of matrices W and H: \(R_{n*d} = W_{n*r} H_{r*d}\)
Where columns in matrix \(W_{n*r}\) represent components, while matrix \(H_{r*d}\) stores the corresponding weights. More importantly, NMF introduces constraints under which: $W \geq 0$ and \(H \geq 0\). The component-wise nonnegativity is a substantial difference from SVD (Gillis, 2017). Additionally to collaborative filtering, one can find use cases of NMF in clustering, image processing, or music analysis.
rmse_nmf = rmse_vs_factors(NMF, data)
plot_rmse(rmse_nmf, "NMF")
param_grid = {'n_factors': [11,14,15,16,17,18,20]}
gs = GridSearchCV(NMF, param_grid, measures=['rmse'], cv=5)
gs.fit(data)
# best RMSE score
print(gs.best_score['rmse'])
# combination of parameters that gave the best RMSE score
print(gs.best_params['rmse'])
0.8861525979842921
{'n_factors': 17}
algo_NMF = NMF(n_factors = 16)
algo_NMF.fit(trainset)
# Predict ratings for all pairs (u, i) that are NOT in the training set.
testset = trainset.build_anti_testset()
predictions = algo_NMF.test(testset)
hist_NMF_124, pred_NMF_124 = get_top_n(predictions, movies_df = movies_df, userId = 124, original_ratings_df = ratings_df)
User 124 has already rated 50 movies.
pred_NMF_124
| userId | movieId | rat_pred | title | genres | |
|---|---|---|---|---|---|
| 0 | 124 | 2324 | 4.604147 | Life Is Beautiful (La Vita è bella) (1997) | Comedy|Drama|Romance|War |
| 1 | 124 | 1089 | 4.558471 | Reservoir Dogs (1992) | Crime|Mystery|Thriller |
| 2 | 124 | 1213 | 4.548465 | Goodfellas (1990) | Crime|Drama |
| 3 | 124 | 1248 | 4.544143 | Touch of Evil (1958) | Crime|Film-Noir|Thriller |
| 4 | 124 | 1104 | 4.541697 | Streetcar Named Desire, A (1951) | Drama |
| 5 | 124 | 750 | 4.536357 | Dr. Strangelove or: How I Learned to Stop Worr... | Comedy|War |
| 6 | 124 | 904 | 4.530793 | Rear Window (1954) | Mystery|Thriller |
| 7 | 124 | 1235 | 4.526960 | Harold and Maude (1971) | Comedy|Drama|Romance |
| 8 | 124 | 1242 | 4.517884 | Glory (1989) | Drama|War |
| 9 | 124 | 898 | 4.512130 | Philadelphia Story, The (1940) | Comedy|Drama|Romance |
Conclusion
The article discussed the “fundamentals of recommender systems and their classification”. Moreover, the author showed how to use Surprise package for two matrix factorization approaches. Among them, SVD achieved slightly lower RMSE (0.864), and therefore performed better, compared to measured RMSE (0.886) by NMF. Both models were hyper parametrized for several latent factors used in training of the algorithms. In addition, the authors showed how to evaluate the models on an individual level by observing the predicted movies and the user's historical rating.
Citation
Lineberry, A., & Longo, C. (2018, September 11). Creating a hybrid content-collaborative movie recommender using deep learning. Retrieved from https://towardsdatascience.com/creating-a-hybrid-content-collaborative-movie-recommender-using-deep-learning-cc8b431618af
Maxwell Harper and Joseph A. Konstan. 2015. The MovieLens Datasets: History and Context. ACM Transactions on Interactive Intelligent Systems (TiiS) 5, 4, Article 19 (December 2015), 19 pages. DOI=http://dx.doi.org/10.1145/2827872
Gillis, N. (2014). The why and how of nonnegative matrix factorization (2). Retrieved from https://arxiv.org/abs/1401.5226v2
Guruswami, V., & Kannan, R. (2012). Singular value decomposition (SVD). In Computer science theory for the information age (pp. 111-135).
Sarwar, Badrul & Badrul, & Karypis, George & Cybenko, George & Konstan, & Joseph, & Reidl, & Tsibouklis, John. (2001). Item-based collaborative filtering recommendation algorithmus.


ValOS Event Log is an ordered, numbered sequence of JSON-LD documents.
Each document represents a single event. Together these events
incrementally, exclusively and deterministically specify the state
changes of a single valospace chronicle from its initial empty state to
the current state after the most recent event.