Lab #3 SOlution





  • TensorFlow

  • Machine Learning basics

Important: Labs are to be completed individually. Do not collaborate with anyone in completion of this assignment.

Do not post solutions, code, or these questions online, or make them accessible outside of this course.

I. Welcome to TensorFlow


This semester your team project will require TensorFlow, an open-source machine learning framework. Now is the time to become familiar with its basics & capabilities.


In Lab 1, you set up Anaconda and started to become familiar with the Python programming language. In this lab, we’ll build on this installation.


To install TensorFlow, use the following conda installation (rather than pip):

conda install -c anaconda tensorflow To use the library in your code, import tensorflow as tf


To install TensorBoard, use the following conda installation:

conda install -c anaconda tensorboard

Open a terminal and type the following to start TensorBoard. The <path> is the fully qualified path to your current project directory.

tensorboard –logdir=<path>

Open a browser and navigate to localhost:6006 to see the tool.

Hello, TF

It’s time to test your installation. Try the “hello, world” TensorFlow application covered in Week 5 (refer to lecture slides on Blackboard > Content > Lectures).

New to both TensorFlow and Machine Learning? Take this time to try out the tutorials built just for you, including “Getting Started for ML Beginners”:

If this tutorial doesn’t speak to you, refer to the course website for additional resources.


(0 points) – Nothing will be turned in for this portion of the lab.


II. Welcome to Vegas


Now that you’re familiar with TensorFlow (..or at least downloaded what you need..), let’s try a basic supervised learning application. We’ll make some predictions to help plan better vacations in Las Vegas, based on reviews from


Provided with this lab description is vegas.csv, which contains review data for Vegas hotels. To view the format of the data, open the file as a spreadsheet (via MS Excel, Google Sheets, Numbers, etc) and examine the first row, which contains labels for each column. Each subsequent row is one hotel review.

Your submission will include three Python files – one for a classification task, one for a regression task, and one to test them (answering the questions in Part III).

Parameters to these tasks may include:

  • Type of trip (noted in the dataset as Traveler Type: Business, Families, etc)

  • Period of stay (i.e.: Dec-Feb, Mar-May)

  • Amenities (i.e.: free wi-fi, pool, spa, tennis courts, etc)

You may assume business trips require free wi-fi, couples trips prefer a spa, and family trips require a pool. Hotels with a higher number of stars are preferable to those with fewer stars. Not all data in the dataset may be useful.

Running this file should leverage the following two functions & print answers to questions in Part III.

This file should contain a function for predicting the best hotel based upon certain parameters. The result must be one of the hotel names in the provided dataset.

This file should contain a function for predicting the score (rating) a given type of traveler will give after their vacation at a given hotel during a given period. The result should be a numeric value between 0.0 and 5.0.


(20 points) – Classification

(25 points) – Regression

(10 points) – Comments – All .py files have a header containing your full name and abc123.

Code in all files is easy to read and commented for clarity.

(5 points) – Correctness – Files properly named & submitted, submission adheres to the outlined requirements.

III. Analysis

Submit your answers to the following questions in a file named Lab3-Questions.pdf.

Your full name and UTSA ID must appear at the top of the page.

  1. (10 points) You and a group of friends are heading to Vegas after finals this May. Predict the best hotel for your getaway.

  1. (10 points) Nicky and William are planning their honeymoon in Las Vegas. Predict the best hotel for them if they plan to travel in July.

  1. (10 points) The Martin family stayed at Circus Circus in October. Predict the rating they will give their hotel on TripAdvisor.

  1. (10 points) Lucky Jackson came to Las Vegas for a tech conference in January. He stayed at The Bellagio Las Vegas. Predict the rating he will give his hotel on TripAdvisor.

Extra Credit

The Anaconda installation comes with Jupyter support as well – open the Anaconda Navigator to see this option. For extra credit, create a Jupyter notebook named abc123lab3.ipynb for this lab – include all code as well as answers to question III. At the top of your notebook must be your full name and UTSA ID (abc123).

More on Project Jupyter :

Remember not to share or post this notebook. It should only be submitted on Blackboard.


On Blackboard, submit only one of the following:

  • containing:

    • Lab3-Questions.pdf




  • abc123lab3.ipynb (extra credit version)

(where abc123 is your UTSA ID)


The data in this exercise has been adapted from the data in the following publication:

Sergio Moro, Paulo Rita, Joana Coelho. (2017) “Stripping customers’ feedback on hotels through data

mining: the case of Las Vegas Strip” Tourism Management Perspectives, 23, 41-52.