1593454800

DeepDow is a Python package that focuses on neural networks that perform asset allocation in a single forward pass.

Portfolio optimization is traditionally a two step procedure:

- Creation of beliefs about the future performance of securities
- Finding optimal portfolio given these beliefs

One notorious example of the two step procedure (inspired by Markowitz) is

- Estimation of expected returns
**μ**and covariance matrix**Σ** - Solving a convex optimization problem

Commonly, these two steps are absolutely separated since they require different approaches and different software.

`deepdow`

absolutely abandons this paradigm. It strives to merge the above mentioned two steps into one. The fundamental idea is to construct end-to-end deep networks that input the rawest features (returns, volumes, …) and output asset allocation. This approach has multiple benefits:

- Hyperparameters can be turned into trainable weights (i.e. 𝛾 in 2nd stage)
- Leveraging deep learning to extract useful features for allocation, no need for technical indicators
- Single loss function

Financial timeseries can be seen as a 3D tensor with the following dimensions

- time
- asset
- indicator/channel

To give a specific example, one can investigate daily (time dimension) open price returns, close price returns and volumes (channel dimension) of multiple NASDAQ stocks (asset dimension). Graphically, one can imagine

By fixing a time step (representing now), we can split our tensor into 3 disjoint subtensors

Firstly, **x** represents all the knowledge about the past and present. The second tensor **g** represents information contained in the immediate future that we cannot use to make investment decisions. Finally, **y** is the future evolution of the market. One can now move along the time dimension and apply the same decomposition at every time step. This method of generating a dataset is called the rolling window.

Now we focus on a special type of neural networks that input **x** and return a single weight allocation **w** over all assets such that they sum up to 1. In other words, given our past knowledge **x** we construct a portfolio **w** that we buy right away and hold for horizon time steps. Let **F** be some neural network with parameters 𝜃, the below image represents the high level prediction pipeline.

The last piece of the puzzle is definition of the loss function. In the most general terms, the per sample loss **L** is any function that inputs **w** and **y** and outputs a real number. However, in most cases we first compute the portfolio returns **r** over each time step in the horizon and then apply some summarization function **S** like mean, standard deviation, etc.

Ok, but how do we construct such networks? Rather than hardcoding a single architecture `deepdow`

implements powerful building blocks (layers) that the user can put together himself. The two most important groups of layers are

The goal is to extract features from the inputs.

- RNN
- 1D convolutions
- Time warping
- …

Given input tensors they output a valid asset allocation.

- Differentiable convex optimization (
`cvxpylayers`

) i.e. Markowitz - Softmax (sparse and constrained variants as well)
- Clustering based allocators
- …

The general pattern is to create a pipeline of multiple transformation layers followed by a single allocation layer at the end. Note that almost any real valued hyperparameter can be turned into a learnable parameter or even predicted by some subnetwork.

#portfolio-management #pytorch #finance #deep-learning #machine-learning #deep learning

1618317562

View more: https://www.inexture.com/services/deep-learning-development/

We at Inexture, strategically work on every project we are associated with. We propose a robust set of AI, ML, and DL consulting services. Our virtuoso team of data scientists and developers meticulously work on every project and add a personalized touch to it. Because we keep our clientele aware of everything being done associated with their project so there’s a sense of transparency being maintained. Leverage our services for your next AI project for end-to-end optimum services.

#deep learning development #deep learning framework #deep learning expert #deep learning ai #deep learning services

1603735200

The Deep Learning DevCon 2020, DLDC 2020, has exciting talks and sessions around the latest developments in the field of deep learning, that will not only be interesting for professionals of this field but also for the enthusiasts who are willing to make a career in the field of deep learning. The two-day conference scheduled for 29th and 30th October will host paper presentations, tech talks, workshops that will uncover some interesting developments as well as the latest research and advancement of this area. Further to this, with deep learning gaining massive traction, this conference will highlight some fascinating use cases across the world.

Here are ten interesting talks and sessions of DLDC 2020 that one should definitely attend:

**Also Read:** Why Deep Learning DevCon Comes At The Right Time

**By Dipanjan Sarkar**

**About: **Adversarial Robustness in Deep Learning is a session presented by Dipanjan Sarkar, a Data Science Lead at Applied Materials, as well as a Google Developer Expert in Machine Learning. In this session, he will focus on the adversarial robustness in the field of deep learning, where he talks about its importance, different types of adversarial attacks, and will showcase some ways to train the neural networks with adversarial realisation. Considering abstract deep learning has brought us tremendous achievements in the fields of computer vision and natural language processing, this talk will be really interesting for people working in this area. With this session, the attendees will have a comprehensive understanding of adversarial perturbations in the field of deep learning and ways to deal with them with common recipes.

Read an interview with Dipanjan Sarkar.

**By Divye Singh**

**About: **Imbalance Handling with Combination of Deep Variational Autoencoder and NEATER is a paper presentation by Divye Singh, who has a masters in technology degree in Mathematical Modeling and Simulation and has the interest to research in the field of artificial intelligence, learning-based systems, machine learning, etc. In this paper presentation, he will talk about the common problem of class imbalance in medical diagnosis and anomaly detection, and how the problem can be solved with a deep learning framework. The talk focuses on the paper, where he has proposed a synergistic over-sampling method generating informative synthetic minority class data by filtering the noise from the over-sampled examples. Further, he will also showcase the experimental results on several real-life imbalanced datasets to prove the effectiveness of the proposed method for binary classification problems.

**By Dongsuk Hong**

**About:** This is a paper presentation given by Dongsuk Hong, who is a PhD in Computer Science, and works in the big data centre of Korea Credit Information Services. This talk will introduce the attendees with machine learning and deep learning models for predicting self-employment default rates using credit information. He will talk about the study, where the DNN model is implemented for two purposes — a sub-model for the selection of credit information variables; and works for cascading to the final model that predicts default rates. Hong’s main research area is data analysis of credit information, where she is particularly interested in evaluating the performance of prediction models based on machine learning and deep learning. This talk will be interesting for the deep learning practitioners who are willing to make a career in this field.

#opinions #attend dldc 2020 #deep learning #deep learning sessions #deep learning talks #dldc 2020 #top deep learning sessions at dldc 2020 #top deep learning talks at dldc 2020

1593454800

DeepDow is a Python package that focuses on neural networks that perform asset allocation in a single forward pass.

Portfolio optimization is traditionally a two step procedure:

- Creation of beliefs about the future performance of securities
- Finding optimal portfolio given these beliefs

One notorious example of the two step procedure (inspired by Markowitz) is

- Estimation of expected returns
**μ**and covariance matrix**Σ** - Solving a convex optimization problem

Commonly, these two steps are absolutely separated since they require different approaches and different software.

`deepdow`

absolutely abandons this paradigm. It strives to merge the above mentioned two steps into one. The fundamental idea is to construct end-to-end deep networks that input the rawest features (returns, volumes, …) and output asset allocation. This approach has multiple benefits:

- Hyperparameters can be turned into trainable weights (i.e. 𝛾 in 2nd stage)
- Leveraging deep learning to extract useful features for allocation, no need for technical indicators
- Single loss function

Financial timeseries can be seen as a 3D tensor with the following dimensions

- time
- asset
- indicator/channel

To give a specific example, one can investigate daily (time dimension) open price returns, close price returns and volumes (channel dimension) of multiple NASDAQ stocks (asset dimension). Graphically, one can imagine

By fixing a time step (representing now), we can split our tensor into 3 disjoint subtensors

Firstly, **x** represents all the knowledge about the past and present. The second tensor **g** represents information contained in the immediate future that we cannot use to make investment decisions. Finally, **y** is the future evolution of the market. One can now move along the time dimension and apply the same decomposition at every time step. This method of generating a dataset is called the rolling window.

Now we focus on a special type of neural networks that input **x** and return a single weight allocation **w** over all assets such that they sum up to 1. In other words, given our past knowledge **x** we construct a portfolio **w** that we buy right away and hold for horizon time steps. Let **F** be some neural network with parameters 𝜃, the below image represents the high level prediction pipeline.

The last piece of the puzzle is definition of the loss function. In the most general terms, the per sample loss **L** is any function that inputs **w** and **y** and outputs a real number. However, in most cases we first compute the portfolio returns **r** over each time step in the horizon and then apply some summarization function **S** like mean, standard deviation, etc.

Ok, but how do we construct such networks? Rather than hardcoding a single architecture `deepdow`

implements powerful building blocks (layers) that the user can put together himself. The two most important groups of layers are

The goal is to extract features from the inputs.

- RNN
- 1D convolutions
- Time warping
- …

Given input tensors they output a valid asset allocation.

- Differentiable convex optimization (
`cvxpylayers`

) i.e. Markowitz - Softmax (sparse and constrained variants as well)
- Clustering based allocators
- …

The general pattern is to create a pipeline of multiple transformation layers followed by a single allocation layer at the end. Note that almost any real valued hyperparameter can be turned into a learnable parameter or even predicted by some subnetwork.

#portfolio-management #pytorch #finance #deep-learning #machine-learning #deep learning

1603753200

So far in our journey through the Machine Learning universe, we covered several big topics. We investigated some **regression** algorithms, **classification** algorithms and algorithms that can be used for both types of problems (**SVM****, ****Decision Trees** and Random Forest). Apart from that, we dipped our toes in unsupervised learning, saw how we can use this type of learning for **clustering** and learned about several clustering techniques.

We also talked about how to quantify machine learning model **performance** and how to improve it with **regularization**. In all these articles, we used Python for “from the scratch” implementations and libraries like **TensorFlow**, **Pytorch** and SciKit Learn. The word optimization popped out more than once in these articles, so in this and next article, we focus on optimization techniques which are an important part of the machine learning process.

In general, every machine learning algorithm is composed of three integral parts:

- A
**loss**function. - Optimization criteria based on the loss function, like a
**cost**function. **Optimization**technique – this process leverages training data to find a solution for optimization criteria (cost function).

As you were able to see in previous articles, some algorithms were created intuitively and didn’t have optimization criteria in mind. In fact, mathematical **explanations** of why and how these algorithms work were done later. Some of these algorithms are **Decision Trees** and **kNN**. Other algorithms, which were developed later had this thing in mind beforehand. **SVM**is one example.

During the training, we change the parameters of our machine learning model to try and **minimize** the loss function. However, the question of how do you change those parameters arises. Also, by how much should we change them during training and when. To answer all these questions we use **optimizers**. They put all different parts of the machine learning algorithm together. So far we mentioned **Gradient Decent** as an optimization technique, but we haven’t explored it in more detail. In this article, we focus on that and we cover the **grandfather** of all optimization techniques and its variation. Note that these techniques are **not** machine learning algorithms. They are solvers of **minimization** problems in which the function to minimize has a gradient in most points of its domain.

Data that we use in this article is the famous *Boston Housing Dataset* . This dataset is composed 14 features and contains information collected by the U.S Census Service concerning housing in the area of Boston Mass. It is a small **dataset** with only 506 samples.

For the purpose of this article, make sure that you have installed the following _Python _libraries:

- **NumPy **– Follow
**this guide**if you need help with installation. - **SciKit Learn **– Follow
**this guide**if you need help with installation. **Pandas**– Follow**this guide**if you need help with installation.

Once installed make sure that you have imported all the necessary modules that are used in this tutorial.

```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import SGDRegressor
```

Apart from that, it would be good to be at least familiar with the basics of **linear algebra**, **calculus** and **probability**.

Note that we also use simple **Linear Regression** in all examples. Due to the fact that we explore **optimization**techniques, we picked the easiest machine learning algorithm. You can see more details about Linear regression **here**. As a quick reminder the formula for linear regression goes like this:

where *w* and *b* are parameters of the machine learning algorithm. The entire point of the training process is to set the correct values to the *w* and *b*, so we get the desired output from the machine learning model. This means that we are trying to make the value of our **error vector** as small as possible, i.e. to find a **global minimum of the cost function**.

One way of solving this problem is to use calculus. We could compute derivatives and then use them to find places where is an extrema of the cost function. However, the cost function is not a function of one or a few variables; it is a function of all parameters of a machine learning algorithm, so these calculations will quickly grow into a monster. That is why we use these optimizers.

#ai #machine learning #python #artificaial inteligance #artificial intelligence #batch gradient descent #data science #datascience #deep learning #from scratch #gradient descent #machine learning #machine learning optimizers #ml optimization #optimizers #scikit learn #software #software craft #software craftsmanship #software development #stochastic gradient descent

1593529260

In the previous blog, we looked into the fact why Few Shot Learning is essential and what are the applications of it. In this article, I will be explaining the Relation Network for Few-Shot Classification (especially for image classification) in the simplest way possible. Moreover, I will be analyzing the Relation Network in terms of:

- Effectiveness of different architectures such as Residual and Inception Networks
- Effects of transfer learning via using pre-trained classifier on ImageNet dataset

Moreover, effectiveness will be evaluated on the accuracy, time required for training, and the number of required training parameters.

Please watch the GitHub repository to check out the implementations and keep updated with further experiments.

In few shot classification, our objective is to design a method which can identify any object images by analyzing few sample images of the same class. Let’s the take one example to understand this. Suppose Bob has a client project to design a 5 class classifier, where 5 classes can be anything and these 5 classes can even change with time. As discussed in previous blog, collecting the huge amount of data is very tedious task. Hence, in such cases, Bob will rely upon few shot classification methods where his client can give few set of example images for each classes and after that his system can perform classification young these examples with or without the need of additional training.

In general, in few shot classification four terminologies (N way, K shot, support set, and query set) are used.

**N way:**It means that there will be total N classes which we will be using for training/testing, like 5 classes in above example.**K shot:**Here, K means we have only K example images available for each classes during training/testing.**Support set:**It represents a collection of all available K examples images from each classes. Therefore, in support set we have total N*K images.**Query set:**This set will have all the images for which we want to predict the respective classes.

At this point, someone new to this concept will have doubt regarding the need of support and query set. So, let’s understand it intuitively. Whenever humans sees any object for the first time, we get the rough idea about that object. Now, in future if we see the same object second time then we will compare it with the image stored in memory from the when we see it for the first time. This applied to all of our surroundings things whether we see, read, or hear. Similarly, to recognise new images from query set, we will provide our model a set of examples i.e., support set to compare.

And this is the basic concept behind Relation Network as well. In next sections, I will be giving the rough idea behind Relation Network and I will be performing different experiments on 102-flower dataset.

The Core idea behind Relation Network is to learn the generalized image representations for each classes using support set such that we can compare lower dimensional representation of query images with each of the class representations. And based on this comparison decide the class of each query images. Relation Network has two modules which allows us to perform above two tasks:

**Embedding module:**This module will extract the required underlying representations from each input images irrespective of the their classes.**Relation Module:**This module will score the relation of embedding of query image with each class embedding.

**Training/Testing procedure:**

We can define the whole procedure in just 5 steps.

- Use the support set and get underlying representations of each images using embedding module.
- Take the average of between each class images and get the single underlying representation for each class.
- Then get the embedding for each query images and concatenate them with each class’ embedding.
- Use the relation module to get the scores. And class with highest score will be the label of respective query image.
- [Only during training] Use MSE loss functions to train both (embedding + relation) modules.

Few things to know during the training is that we will use only images from the set of selective class, and during the testing, we will be using images from unseen classes. For example, from the 102-flower dataset, we will use 50% classes for training, and rest will be used for validation and testing. Moreover, in each episode, we will randomly select 5 classes to create the support and query set and follow the above 5 steps.

That is all need to know about the implementation point of view. Although the whole process is simple and easy to understand, I’ll recommend reading the published research paper, Learning to Compare: Relation Network for Few-Shot Learning, for better understanding.

#deep-learning #few-shot-learning #computer-vision #machine-learning #deep learning #deep learning