# US 2024/0176988 A1 · Generating low-distortion, in-distribution neighborhood samples of an instance of a dataset using a variational autoencoder

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0176988 A1
- Document ID: US20240176988A1
- Status: Published application
- Kind: A1
- Application number: 18/070,388
- Filed: 2022-11-28
- Published: 2024-05-30
- Earliest claimed: 2022-11-28
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Natalia Martinez Gil; Kanthi Sarpatwar; Roman Vaculin
- Web page: https://patentgrep.com/patent/US20240176988A1

## CPC

- G06N 3/0455: Auto-encoder networks; Encoder-decoder networks
- G06N 3/044: Recurrent networks, e.g. Hopfield networks
- G06N 3/045: Combinations of networks
- G06N 3/047: Probabilistic or stochastic networks
- G06N 3/088: Non-supervised learning, e.g. competitive learning
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A computer-implemented method, system and computer program product for utilizing a variational autoencoder for neighborhood sampling. A variational autoencoder is trained to generate in-distribution neighborhood samples. Upon training the variational autoencoder to generate in-distribution neighborhood samples, in-distribution neighborhood samples of an instance of a dataset in latent space that satisfy a distortion constraint are generated using the trained variational autoencoder. A set of interpretable examples for the in-distribution neighborhood samples are then generated using a k-nearest neighbors algorithm. Such interpretable examples are then used to explain the black box model's predictions. As a result, the accuracy of the decision making ability of post-hoc local explanation methods is improved.

## Claims

### Claim 1

A computer-implemented method for utilizing a variational autoencoder for neighborhood sampling, the method comprising:
training said variational autoencoder to generate in-distribution neighborhood samples;
generating, using said trained variational autoencoder, in-distribution neighborhood samples of an instance of a dataset in a latent space that satisfies a distortion constraint; and
generating a set of interpretable examples for said in-distribution neighborhood samples using a k-nearest neighbors algorithm.

### Claim 2 (depends on 1)

The method as recited in claim 1, wherein said variational autoencoder is trained to generate said in-distribution neighborhood samples of said instance of said dataset in said latent space by:
encoding an input as a distribution over said latent space, wherein said input comprises an instance of said dataset;
sampling a point of said distribution from said latent space;
decoding said sampled point which corresponds to an input reconstruction, wherein said input reconstruction satisfies a minimum distortion level;
computing a reconstruction error; and
minimizing said reconstruction error.

### Claim 3 (depends on 1)

The method as recited in claim 1 further comprising:
encoding said instance of said dataset; and
computing a mean and a standard deviation of said encoded instance.

### Claim 4 (depends on 3)

The method as recited in claim 3 further comprising:
sampling a set of latent vectors from a Gaussian distribution with said mean and said standard deviation of said encoded instance.

### Claim 5 (depends on 4)

The method as recited in claim 4 further comprising:
receiving a lower bound for said latent space of said in-distribution neighborhood samples;
estimating percentiles of a Gaussian variational autoencoder distortion distribution to compute an upper bound for said latent space of said in-distribution neighborhood samples;
normalizing said set of latent vectors; and
resampling said normalized latent vectors according to a chi-square distribution using said lower bound for said latent space and said upper bound for said latent space, wherein said resampled normalized latent vectors correspond to said generated in-distribution neighborhood samples of said instance of said dataset that satisfy said distortion constraint.

### Claim 6 (depends on 1)

The method as recited in claim 1 further comprising:
sampling a set of representative examples from said generated in-distribution neighborhood samples in said latent space that belong to a class;
computing a set of k-nearest neighbors to said instance of said dataset in said latent space with respect to said set of representative examples; and
generating said set of interpretable examples for said in-distribution neighborhood samples from said sampled set of representative examples corresponding to said k-nearest neighbors.

### Claim 7 (depends on 1)

The method as recited in claim 1, wherein said dataset comprises time-series data or image data.

### Claim 8

A computer program product for utilizing a variational autoencoder for neighborhood sampling, the computer program product comprising one or more computer readable storage mediums having program code embodied therewith, the program code comprising programming instructions for:
training said variational autoencoder to generate in-distribution neighborhood samples;
generating, using said trained variational autoencoder, in-distribution neighborhood samples of an instance of a dataset in a latent space that satisfies a distortion constraint; and
generating a set of interpretable examples for said in-distribution neighborhood samples using a k-nearest neighbors algorithm.

### Claim 9 (depends on 8)

The computer program product as recited in claim 8, wherein said variational autoencoder is trained to generate said in-distribution neighborhood samples of said instance of said dataset in said latent space by:
encoding an input as a distribution over said latent space, wherein said input comprises an instance of said dataset;
sampling a point of said distribution from said latent space;
decoding said sampled point which corresponds to an input reconstruction, wherein said input reconstruction satisfies a minimum distortion level;
computing a reconstruction error; and
minimizing said reconstruction error.

### Claim 10 (depends on 8)

The computer program product as recited in claim 8, wherein the program code further comprises the programming instructions for:
encoding said instance of said dataset; and
computing a mean and a standard deviation of said encoded instance.

### Claim 11 (depends on 10)

The computer program product as recited in claim 10, wherein the program code further comprises the programming instructions for:
sampling a set of latent vectors from a Gaussian distribution with said mean and said standard deviation of said encoded instance.

### Claim 12 (depends on 11)

The computer program product as recited in claim 11, wherein the program code further comprises the programming instructions for:
receiving a lower bound for said latent space of said in-distribution neighborhood samples;
estimating percentiles of a Gaussian variational autoencoder distortion distribution to compute an upper bound for said latent space of said in-distribution neighborhood samples; 5
normalizing said set of latent vectors; and
resampling said normalized latent vectors according to a chi-square distribution using said lower bound for said latent space and said upper bound for said latent space, wherein said resampled normalized latent vectors correspond to said generated in-distribution neighborhood samples of said instance of said dataset that satisfy said distortion constraint. 10

### Claim 13 (depends on 8)

The computer program product as recited in claim 8, wherein the program code further comprises the programming instructions for:
sampling a set of representative examples from said generated in-distribution neighborhood samples in said latent space that belong to a class;
computing a set of k-nearest neighbors to said instance of said dataset in said latent space with respect to said set of representative examples; and
generating said set of interpretable examples for said in-distribution neighborhood samples from said sampled set of representative examples corresponding to said k-nearest neighbors.

### Claim 14 (depends on 8)

The computer program product as recited in claim 8, wherein said dataset comprises time-series data or image data.

### Claim 15

A system, comprising:
a memory for storing a computer program for utilizing a variational autoencoder for neighborhood sampling; and
a processor connected to said memory, wherein said processor is configured to execute program instructions of the computer program comprising:
training said variational autoencoder to generate in-distribution neighborhood samples;
generating, using said trained variational autoencoder, in-distribution neighborhood samples of an instance of a dataset in a latent space that satisfies a distortion constraint; and
generating a set of interpretable examples for said in-distribution neighborhood samples using a k-nearest neighbors algorithm.

### Claim 16 (depends on 15)

The system as recited in claim 15, wherein said variational autoencoder is trained to generate said in-distribution neighborhood samples of said instance of said dataset in said latent space by:
encoding an input as a distribution over said latent space, wherein said input comprises an instance of said dataset;
sampling a point of said distribution from said latent space;
decoding said sampled point which corresponds to an input reconstruction, wherein said input reconstruction satisfies a minimum distortion level;
computing a reconstruction error; and
minimizing said reconstruction error.

### Claim 17 (depends on 15)

The system as recited in claim 15, wherein the program instructions of the computer program further comprise:
encoding said instance of said dataset; and
computing a mean and a standard deviation of said encoded instance.

### Claim 18 (depends on 17)

The system as recited in claim 17, wherein the program instructions of the computer program further comprise:
sampling a set of latent vectors from a Gaussian distribution with said mean and said standard deviation of said encoded instance.

### Claim 19 (depends on 18)

The system as recited in claim 18, wherein the program instructions of the computer program further comprise:
receiving a lower bound for said latent space of said in-distribution neighborhood samples;
estimating percentiles of a Gaussian variational autoencoder distortion distribution to compute an upper bound for said latent space of said in-distribution neighborhood samples;
normalizing said set of latent vectors; and
resampling said normalized latent vectors according to a chi-square distribution using said lower bound for said latent space and said upper bound for said latent space, wherein said resampled normalized latent vectors correspond to said generated in-distribution neighborhood samples of said instance of said dataset that satisfy said distortion constraint.

### Claim 20 (depends on 15)

The system as recited in claim 15, wherein the program instructions of the computer program further comprise:
sampling a set of representative examples from said generated in-distribution neighborhood samples in said latent space that belong to a class;
computing a set of k-nearest neighbors to said instance of said dataset in said latent space with respect to said set of representative examples; and
generating said set of interpretable examples for said in-distribution neighborhood samples from said sampled set of representative examples corresponding to said k-nearest neighbors.
