Is there any code example of data imputation by VAE or SDA by using deeplearning4j - deeplearning4j

I am trying to impute images, like:
https://www.researchgate.net/publication/284476380_Variational_Auto-encoded_Deep_Gaussian_Processes
The example of mnist image imputation.
How to do it by using deeplearning4j VAE or SDA?

Here's a DL4J example of a variational autoencoder (VAE) https://github.com/deeplearning4j/dl4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/unsupervised/variational
All Deeplearning4j and DataVec/ETL examples can be found here:
https://github.com/deeplearning4j/dl4j-examples/
Please join our developer community on Gitter if you have more questions:
https://gitter.im/deeplearning4j/deeplearning4j

Related

Is sklearn LinearSVC an SVM or SVC?

I was watching a YouTube video to learn about Support Vector Machines (SVM).
In the video, he mentions that an SVM finds Support Vector Classifiers (SVC) for dividing the data as one step in their classifying process.
I have used LinearSVC from scikit-learn for classification, but I have a hard time understanding if the implementation of LinearSVC in scikit-learn is an SVM or an SVC, or if the description in the video is incorrect. I find contradicting descriptions on different sites.
The accepted answer in this question states that LinearSVC is not an SVM, but either it does not say that it is an SVC.
On the description page of LinearSVC it says "Linear Support Vector Classification", but under "See also" on this page, it says that LinearSVC is "Scalable Linear Support Vector Machine for classification implemented using liblinear".
From what I can understand, LinearSVC and SVC(kernel='linear') are not the same, but that is not the question.
Thanks!
In terms of Machine Learning concepts LinearSVC is both because:
SVM is a model/algorithm used to find a plane that splits the space of samples
this can be applied for both classification (SVC) and regression (SVR) - both SVC and SVR are kinds of SVMs
So, an SVC would be a kind of SVM and LinearSVC looks like a specific kind of SVC, although not extending a base SVC class in scikit-learn.
If you mean sklearn source code - the LinearSVC is in the svm module... so it's an SVM. It doesn't extend the SVC or BaseSVC classes but to me this is an implementation issue/detail and I'd rather think of it as an SVC.

Dataset for Bayesian Network Structure Learning

After tons of researches, I didn't find a repository with the necessary material to test a algorithm able to learn the structure of a Bayesian Network. What I need are only 2 things:
the correct Bayesian Network
a Dataset related to the BN
My algorithm should be able to learn the structure from the dataset and then I could check how far from the right BN it is. Do you have any links? I've already found some dataset without the original BN and viceversa but I need both of them for my university project.
Thanks in advance
PS: if you are interested, I use Python for my project.
Try the bnlearn library. It contains structure learning, parameter learning, inference and various example datasets such as sprinkler, asia, alarm, and many more.
Various examples can be found here.
Blog about detecting causal relationships can be found here.
Example for structure learning and making inferences:
# Load library
import bnlearn as bn
# Load Asia DAG
DAG = bn.import_DAG('asia')
# plot ground truth
G = bn.plot(DAG)
# Sampling
df = bn.sampling(DAG, n=10000)
# Structure learning
model_sl = bn.structure_learning.fit(df, methodtype='hc', scoretype='bic')
# Plot based on structure learning of sampled data
bn.plot(model_sl, pos=G['pos'], interactive=True)
# Compare networks and make plot
# bn.compare_networks(model, model_sl, pos=G['pos'])

How to load EMNIST data to Tensorflow

In all the tutorials i've seen for tensorflow, they've used the MNIST dataset, i've understood the modelling but how do i load this dataset into tensorflow?
https://www.nist.gov/itl/iad/image-group/emnist-dataset
The EMNIST dataset uses the same binary format as the original MNIST dataset. Therefore you can take the input pipeline code from any tutorial that uses the original MNIST dataset, and point it at the set of files you get from downloading the EMNIST dataset to train on that dataset.
You can load the EMNIST data file in Matlab format with scipy.io.loadmat(). The array has to be rotated after loading. There is a Jupyter Notebook on GitHub which does EMNIST Digits classification.
You could use the EMNIST package that can be found here: https://pypi.org/project/emnist/
To load the dataset you first need to decide which of the six different datasets you would like to work with. Details in this paper: https://arxiv.org/pdf/1702.05373v1.pdf
Let's say we want to use the byclass dataset:
from emnist import extract_training_samples, extract_test_samples
x_train, y_train = extract_training_samples('byclass')
x_test, y_test = extract_test_samples('byclass')

Train MFCC using Machine Learning Algorithm

I have a datasets of MFCC that I know is good. I know how to put a row vector into a machine learning algorithm. My question is how to do it with MFCC, as it is a matrix? For example, how would I put this inside a machine learning algorithm:?
http://archive.ics.uci.edu/ml/machine-learning-databases/00195/Test_Arabic_Digit.txt
Any algorithm will work. I am looking at a binary classifier, but will be looking into it more. Scikit seems like a good resource. For now I would just like to know how to input MFCC into an algorithm. Step by step would help me a lot! I have looked in a lot of places but have not found an answer.
Thank you
In python, you can easily flatten a matrix so it becomes in a vector,for example you can use numpy and numpy's flatten function ,additionally an idea that comes to my mind(it's just an idea may or may not work) is to use convolutions, convolutions work very well with 2d structures.

How do we get/define filters in convolutional neural networks?

How to implement a deep autoencoder (eHow do i obtain filters from convulutional neural network(CNN)? My idea is something like this: Do random images of the input images (28x28) and get random patches (8x8). Then use autoencoders to learn the common features of the patches (features = hidden units; approximately 100, for example). Then apply features filters to the input images and do convolution. Am I correct?
I am confused because sometime the literature state only using like, e.g. 8, filters, but in my case I have 100..g. 2 or 3 layers)? Any ideas or resources?
You can follow the tutorial : http://ufldl.stanford.edu/wiki/index.php/UFLDL_Tutorial
This is like a lecture on both auto-encoders and some simple stuff about CNN (convolution and pooling). When you complete this tutorial you will have both auto-encoder implementation and stacked-auto-encoder in your words deep auto-encoder implementation ready.
This tutorial will have exactly what you ask for:
28x28 MNIST images
getting 8x8 patches and learning filters using auto-encoders
convolving these images by these 8x8 filters
pooling them
using the pooled vectors/images and putting them in a soft-max classifier to learn 10 different classes of MNIST database.

Resources