Skip to main content

Blog

Learn About Our Meetup

5000+ Members

MEETUPS

LEARN, CONNECT, SHARE

Join our meetup, learn, connect, share, and get to know your Toronto AI community. 

JOB POSTINGS

INDEED POSTINGS

Browse through the latest deep learning, ai, machine learning postings from Indeed for the GTA.

CONTACT

CONNECT WITH US

Are you looking to sponsor space, be a speaker, or volunteer, feel free to give us a shout.

Author: torontoai

Introducing TensorNetwork, an Open Source Library for Efficient Tensor Calculations

Many of the world’s toughest scientific challenges, like developing high-temperature superconductors and understanding the true nature of space and time, involve dealing with the complexity of quantum systems. What makes these challenges difficult is that the number of quantum states in these systems is exponentially large, making brute-force computation infeasible. To deal with this, data structures called tensor networks are used. Tensor networks let one focus on the quantum states that are most relevant for real-world problems—the states of low energy, say—while ignoring other states that aren’t relevant. Tensor networks are also increasingly finding applications in machine learning (ML). However, there remain difficulties that prohibit them from widespread use in the ML community: 1) a production-level tensor network library for accelerated hardware has not been available to run tensor network algorithms at scale, and 2) most of the tensor network literature is geared toward physics applications and creates the false impression that expertise in quantum mechanics is required to understand the algorithms.

In order to address these issues, we are releasing TensorNetwork, a brand new open source library to improve the efficiency of tensor calculations, developed in collaboration with the Perimeter Institute for Theoretical Physics and X. TensorNetwork uses TensorFlow as a backend and is optimized for GPU processing, which can enable speedups of up to 100x when compared to work on a CPU. We introduce TensorNetwork in a series of papers, the first of which presents the new library and its API, and provides an overview of tensor networks for a non-physics audience. In our second paper we focus on a particular use case in physics, demonstrating the speedup that one gets using GPUs.

How are Tensor Networks Useful?
Tensors are multidimensional arrays, categorized in a hierarchy according to their order: e.g., an ordinary number is a tensor of order zero (also known as a scalar), a vector is an order-one tensor, a matrix is an order-two tensor, and so on. While low-order tensors can easily be represented by an explicit array of numbers or with a mathematical symbol such as Tijnklm (where the number of indices represents the order of the tensor), that notation becomes very cumbersome once we start talking about high-order tensors. At that point it’s useful to start using diagrammatic notation, where one simply draws a circle (or some other shape) with a number of lines, or legs, coming out of it—the number of legs being the same as the order of the tensor. In this notation, a scalar is just a circle, a vector has a single leg, a matrix has two legs, etc. Each leg of the tensor also has a dimension, which is the size of that leg. For example, a vector representing an object’s velocity through space would be a three-dimensional, order-one tensor.

Diagrammatic notation for tensors.

The benefit of representing tensors in this way is to succinctly encode mathematical operations, e.g., multiplying a matrix by a vector to produce another vector, or multiplying two vectors to make a scalar. These are all examples of a more general concept called tensor contraction.

Diagrammatic notation for tensor contraction. Vector and matrix multiplication, as well as the matrix trace (i.e., the sum of the diagonal elements of a matrix), are all examples.

These are also simple examples of tensor networks, which are graphical ways of encoding the pattern of tensor contractions of several constituent tensors to form a new one. Each constituent tensor has an order determined by its own number of legs. Legs that are connected, forming an edge in the diagram, represent contraction, while the number of remaining dangling legs determines the order of the resultant tensor.

Left: The trace of the product of four matrices, tr(ABCD), which is a scalar. You can see that it has no dangling legs. Right: Three order-three tensors being contracted with three legs dangling, resulting in a new order-three tensor.

While these examples are very simple, the tensor networks of interest often represent hundreds of tensors contracted in a variety of ways. Describing such a thing would be very obscure using traditional notation, which is why the diagrammatic notation was invented by Roger Penrose in 1971.

Tensor Networks in Practice
Consider a collection of black-and-white images, each of which can be thought of as a list of N pixel values. A single pixel of a single image can be one-hot-encoded into a two-dimensional vector, and by combining these pixel encodings together we can make a 2N-dimensional one-hot encoding of the entire image. We can reshape that high-dimensional vector into an order-N tensor, and then add up all of the tensors in our collection of images to get a total tensor Ti1,i2,…,iN encapsulating the collection.

This sounds like a very wasteful thing to do: encoding images with about 50 pixels in this way would already take petabytes of memory. That’s where tensor networks come in. Rather than storing or manipulating the tensor T directly, we instead represent T as the contraction of many smaller constituent tensors in the shape of a tensor network. That turns out to be much more efficient. For instance, the popular matrix product state (MPS) network would write T in terms of N much smaller tensors, so that the total number of parameters is only linear in N, rather than exponential.

The high-order tensor T is represented in terms of many low-order tensors in a matrix product state tensor network.

It’s not obvious that large tensor networks can be efficiently created or manipulated while consistently avoiding the need for a huge amount of memory. But it turns out that this is possible in many cases, which is why tensor networks have been used extensively in quantum physics and, now, in machine learning. Stoudenmire and Schwab used the encoding just described to make an image classification model, demonstrating a new use for tensor networks. The TensorNetwork library is designed to facilitate exactly that kind of work, and our first paper describes how the library functions for general tensor network manipulations.

Performance in Physics Use-Cases
TensorNetwork is a general-purpose library for tensor network algorithms, and so it should prove useful for physicists as well. Approximating quantum states is a typical use-case for tensor networks in physics, and is well-suited to illustrate the capabilities of the TensorNetwork library. In our second paper, we describe a tree tensor network (TTN) algorithm for approximating the ground state of either a periodic quantum spin chain (1D) or a lattice model on a thin torus (2D), and implement the algorithm using TensorNetwork. We compare the use of CPUs with GPUs and observe significant computational speed-ups, up to a factor of 100, when using a GPU and the TensorNetwork library.

Computational time as a function of the bond dimension, χ. The bond dimension determines the size of the constituent tensors of the tensor network. A larger bond dimension means the tensor network is more powerful, but requires more computational resources to manipulate.

Conclusion and Future Work
These are the first in a series of planned papers to illustrate the power of TensorNetwork in real-world applications. In our next paper we will use TensorNetwork to classify images in the MNIST and Fashion-MNIST datasets. Future plans include time series analysis on the ML side, and quantum circuit simulation on the physics side. With the open source community, we are also always adding new features to TensorNetwork itself. We hope that TensorNetwork will become a valuable tool for physicists and machine learning practitioners.

Acknowledgements
The TensorNetwork library was developed by Chase Roberts, Adam Zalcman, and Bruce Fontaine of Google AI; Ashley Milsted, Martin Ganahl, and Guifre Vidal of the Perimeter Institute; and Jack Hidary and Stefan Leichenauer of X. We’d also like to thank Stavros Efthymiou at X for valuable contributions.

[R] CVPR 2019 Noise-Tolerant Training work `Learning to Learn from Noisy Labeled Data ‘

https://arxiv.org/pdf/1812.05214.pdf

This work achieves promising results with meta-learning. Our result on Clothing 1M is comparable with theirs. However, their modelling via meta-learning seems extremely complex in practice.

Too many hyper-parameters shown in their Algorithm 1 and implementation section 4.2:

  1. The number of synthetic mini-batches (meta-training iterations) M;
  2. Meta-training step size alpha;
  3. Meta-learning rate eta;
  4. Student learning rate beta;
  5. Exponential moving average (EMA) decay gamma;
  6. The threshold for data filtering tau;
  7. The number of samples with label replacement, rho;

The strategies of iterative training together with iterative data filtering/cleaning, reusing last-round best model as mentor, etc., make it difficult to handle in practice.

However, the ideas are interesting and novel:

  1. Oracle/Mentor (Consistency loss): To make meta-test reliable, the teacher/mentor model should be reliable and robust to real noisy examples. Therefore, they apply iterative training and iterative data cleaning to make the meta-test consistency loss reliable and an optimisation oracle against real noise.
  2. Unaffected by synthetic noise: The meta-training sees synthetic noisy training examples. After training on them, the meta-testing evaluates its consistency with oracle and aims to maximise the consistency, i.e., making it unaffected after seeing synthetic noise.

Quetions arise:

Is meta-learning really a good solution in practice with such many configurations?

Or could we simplfiy its modelling to make it easier in practice?

submitted by /u/XinshaoWang
[link] [comments]

[R] Learning Perceptually-Aligned Representations via Adversarial Robustness

Blog Post: http://gradientscience.org/robust_reps

Paper: https://arxiv.org/abs/1906.00945

TL;DR: Representation layers of standard networks are really useful for, e.g. transfer learning, but are extremely brittle and known to sort of “break down” when it comes to manipulating them or visualizing them in natural ways. We propose robust optimization (adversarial training) as a way to enforce priors on models’ learned features. The resulting models (just lp-robust classifiers) are amenable to all sorts of “natural” manipulation that follow exactly from our idealization of representations as high-level features, but are impossible with standard networks. This suggests that robustness might be more broadly useful than just protection against adversarial examples.

submitted by /u/andrew_ilyas
[link] [comments]

[D] Velocity control for autonomous vehicles

I’ve been reading a lot lately about autonomous vehicles (self-driving cars), and see lots of different algorithms people use to try to regulate what speed the car should be going. What I don’t find many articles on lately (mostly articles from the 90s) are how to actually regulate the car’s current parameters (speed, acceleration, steering) compared to the desired outcome (i.e. what your algorithm told you to adjust your parameters to).

My initial thought (and this is what cruise control uses, at least in the past, for example) is that velocity and steering are controlled by PID controllers. Is that true now, even on vehicles whose desired velocity/steering inputs are determined from machine learning algorithms? If not, can anyone elaborate or point me in a direction where I can learn more about this? For example, if you train a vehicle to drive based off of driving data, suppose your algorithm tells you to speed up. When you increase the throttle, if for some unseen reason your acceleration isn’t at what the algorithm wants you to be at, what happens, and what is in charge of how to handle these differences?

submitted by /u/figglesfiggles
[link] [comments]

[D] Handling Lag Features for different time frames.

[D] Handling Lag Features for different time frames.

Hi,

I’m currently working on a project which involves a sort of time series problem which I transformed to a classification problem for more detailed prediction, i.e. rather than having an aggregated figure at the end of the day in the time series modeling of the problem, I rather classify single instances which eventually depict the figure of the time series modeling when aggregated.

To summarize, the problem setting is actually a scheduling problem where a employee is assigned to a shift and the prediction is whether employees will be absent or not for the respective, scheduled shift.

Anyway, I try to train two different models which should be used at two different ponts in time. One is basically a 24h model which should predict instances scheduled for the next day and one model which should predict the very same instances one week beforehand. Below, I tried to illustrate the problem on a time line, hope this helps.

https://i.redd.it/pb1f5pqppc231.png

I started with the former model which seems a bit easier, as all information that can be available, are available at prediction point for this model. I did some feature engineering which mostly includes lag features that is over the last instances that are recorded. Since the lag features seems to contribute quite well to the model’s performance, I actually wanted to re-use them in the ‘one-week’ model. However, I face the problem that I don’t know how to calculate them accurately (if that makes even sense in this case).

As you can see in the second time line, between the prediction point and the time where the instance is scheduled I’d like to predict, there’s a gap of a week where there could potentially be more scheduled instances. I’m not sure how to deal with it. If I was ignoring the gap week completely and keep on calculating the lag features in the same sense as in the 24h model, I feel that this will not work out quite well (although I haven’t tried it yet).

Unfortunately, I couldn’t find any literature on this problem or some sort of kaggle competition where this problem was also faced. Therefore, I don’t have any ideas how to handle it and would appreciate any kind of ideas from you guys.

Thanks very much!

submitted by /u/babuunn
[link] [comments]

Booking.com Data Science Interview Questions

There are 28 Million+ listings to stay on Booking.com.

Booking.com is the travel E-Commerce part of Booking Holdings. They have over 140,000+ destinations in 230 countries all over the world. They also have over 1.5 Million+ nights reserved every day on their platform. From a data science perspective, this translates into over 300 TB of data. A robust data engineering infrastructure coupled with huge amounts of data makes Booking.com one of the best places for a Data Scientist to build their career.

Photo by John Matychuk on Unsplash

Interview Process

The interview process starts with MCQ based test on machine learning and statistics questions.That is followed by the HR phone interview. Once you clear both of those, there is a technical phone interview with data scientists. This is based around your projects and also includes a case study discussion. Finally there is an onsite interview which consists of technical interviews, behavioural interview and hiring manager interview.

Important Reading

Booking.com streaming ecosystem

Data Science Related Interview Questions

  • What is the difference between L1 and L2 regularization?
  • What is gradient decent?
  • Why did you use Random Forests instead of Clustering on a particular problem?(case study)
  • How to deal with new hotels that do not have an official rating?
  • If the training error and the testing error are both high, as the number of data points increase, what measures will you take to fix the model?
  • How would you optimize the advertising that directs people to your site? How do you evaluate how much to spend on each channel?
  • What do you do to make sure your model is not over fitting?
  • Given a business case as such, how would you handle this with a Machine Learning solution?
  • How did you validate your model?
  • What are the parameters of decision trees and random forests, and how would you choose them?

Reflecting on the Questions

Booking.com is headquartered in Amsterdam but has offices all over the globe. Data dictates the spending and drives efficiency in their business. It is a critical component of their product. The questions are about deep data science fundamentals and also about the different situations within their business where they deploy data science. A good knowledge of Data Science fundamentals coupled with know how about their business can surely land you a job with one of the world’s largest booking sites!

Subscribe to our Acing AI newsletter, I promise not to spam and its FREE!

Acing AI Newsletter – Revue

Thanks for reading! 😊 If you enjoyed it, test how many times can you hit 👏 in 5 seconds. It’s great cardio for your fingers AND will help other people see the story.

The sole motivation of this blog article is to learn about Booking.com and its technologies helping people to get into it. All data is sourced from online public sources. I aim to make this a living document, so any updates and suggested changes can always be included. Please provide relevant feedback.


Booking.com Data Science Interview Questions was originally published in Acing AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

[R] Understanding and Controlling Memory in Recurrent Neural Networks (ICML’19 oral)

This paper shows that RNNs are able to form long-term memories despite being trained only for short-term with a limited amount of timesteps, but that not all memories are created equal. The authors find that each memory is correlated with a dynamical object in the hidden-state phase space and that the objects properties can quantitatively predict long term effectiveness. By regularizing the dynamical object, the long-term functionality of the RNN is significantly improved, while not adding to the computational complexity of training.

Link to PDF: http://proceedings.mlr.press/v97/haviv19a/haviv19a.pdf

Oral: Tue Jun 11th 03:10 PM @ Room 201

Poster: Tue Jun 11th 06:30 PM @ Pacific Ballroom #258

submitted by /u/DoronHaviv12
[link] [comments]