# Job: Class Probability Filter (Legacy)

## At a Glance

Keep particles which have a high probability of belonging to selected 2D or 3D classes.

![](/files/kDDKiLUF7Jg2CS4cJy9c)

## Description

{% hint style="info" %}
In CryoSPARC v4.7, Class Probability Filter’s functionality was moved to the more-flexible [Subset Particles by Statistic](/processing-data/all-job-types-in-cryosparc/particle-curation/job-subset-particles-by-statistic.md). See [Recommended Alternatives](#recommended-alternatives) for more information.
{% endhint %}

In most particle curation pipelines, 2D and 3D classification are used to group particles into good and bad classes (that is, classes which do and do not look like the target). Particles can then be retained for downstream analysis if they belong to a good class and discarded if they belong to a bad class. In other words, particles are selected using a binary filter — they either are or are not in a good class.

Most classification jobs in CryoSPARC assign classes a probability of belonging to a class, rather than a binary in or out classification. When using class membership to filter particles, particles are considered to be members of the class *for which they have the highest probability*. Good particles ideally have a high probability of belonging to one class and a low probability of belonging to all others.

For example, the top two particles images in the figure at the top of this article have much higher probability of belonging to the cone or cube (respectively) than any other class. Filtering particles by their best class is often sufficient for high-quality data.

Consider, on the other hand, a junk particle (the third particle image in the figure at the top of this article). Since it is random noise, it has a relatively low probability of belonging to any class. If it happens by random chance to have the highest probability of belonging to a good class it will still be selected, despite the fact that its probability in that class may be much lower than particles which truly belong to that class. In this example, the junk particle has a probability of `0.26` of belonging to the cube class, which is greater than its probability of belonging to any other class so if we took all particles in the cube class we would also take this junk particle.

The Class Probability Filter job filters particles by their *probability* of belonging to a given class or set of classes, rather than simply by whether they are more likely to belong to a good class than a bad class. Considering the example above again, if we designate the cube and cone as good classes and only keep particles with a 75% or greater chance of belonging to one of those two classes, the good particles will be kept and the junk pick will correctly be discarded.

## Inputs

### Particle stacks

This job accepts particles which have been classified either in [2D Classification](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/particle-curation/job-2d-classification), [A*b-Initio* Reconstruction](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/3d-reconstruction/job-ab-initio-reconstruction), or [Heterogeneous Refinement](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/3d-refinement/job-heterogeneous-refinement). If particles come from a 2D Classification, it is generally best to select good classes in Select 2D Classes first.

## Commonly Adjusted Parameters

This job acts on either 2D or 3D class probabilities. Because of how jobs work under the hood in CryoSPARC, either 3D **or** 2D parameters must be set. Setting both or the wrong parameter will cause the job to fail when it looks for data which is not there.

### 3D Parameters

#### 3D Class Indexes

Indexes of good classes. These can be found in several places, including the output panel. For instance, if the good volumes are labeled “Volume class 0” and “Volume class 2” in the output panel, entering `0,2` for this parameter would select those classes as good and the rest as bad.

#### 3D Class Threshold

Class Probability Filter will keep only particles which have a **total probability**, across all input classes, of this value or greater.

For instance, say we have classified three particles into four classes. Classes 1 and 2 are good classes, and we want to keep any particle that has a **total probability** of being in a good class of 0.6 or better. If we only look at individual probabilities, no particles meet this threshold:

![](/files/PTKhanJ380FqZ3Xtcz8H)

However, if we consider the sum of the probability of all good classes (provided by `3D Class Indexes`), then particles 2 and 3 both clear the threshold of 0.6:

![](/files/LfO96VHdfvnjZlCCRSVk)

### 2D Parameters

#### 2D Class Threshold

Class Probability Filter will keep only particles which have a **probability in their best class** of at least this value.

For instance, if the input particles are classified into four classes A, B, C, and D and this parameter was set to `0.9`, a particle would be kept if its probabilities were `0.95, 0.01, 0.01, 0.00` but not `0.4, 0.3, 0.2, 0.0`. Note that there is no way to know whether this high probability comes from a good or bad class. Class Probability Filter selects particles based on the confidence of their assignment, not the quality of the class they are assigned to.

{% hint style="info" %}
To select particles confidently assigned to good classes, first select good classes using Select 2D Classes, then feed the selected particles into Class Probability Filter.
{% endhint %}

## Outputs

### Selected Particles

Particles with a total probability greater than or equal to the threshold are in this output group, otherwise unchanged.

### Excluded Particles

Particles with a total probability less than the threshold are in this output group, otherwise unchanged.

## Recommended Alternatives

[Subset Particles by Statistic](/processing-data/all-job-types-in-cryosparc/particle-curation/job-subset-particles-by-statistic.md#class-probability), released in CryoSPARC v4.7, performs this analysis when `Subset by` is set to `Class probability - 2D` or `Class probability - 3D`. It can operate with a single threshold (like Class Probability Filter does), or with multiple thresholds. Additionally, it can cluster particles by their class probability with a Gaussian mixture model. As such, Class Probability Filter is a legacy job in v4.7, and this type of analysis should be performed with Subset Particles by Statistic instead.

## At a Glance

Keep particles which have a high probability of belonging to selected 2D or 3D classes.

<figure><img src="/files/kDDKiLUF7Jg2CS4cJy9c" alt=""><figcaption></figcaption></figure>

## Description

{% hint style="info" %}
In cryoSPARC v4.7, Class Probability Filter’s functionality was moved to the more-flexible Subset Particles by Statistic. See Recommended Alternatives for more information.
{% endhint %}

In most particle curation pipelines, 2D and 3D classification are used to group particles into good and bad classes (that is, classes which do and do not look like the target). Particles can then be retained for downstream analysis if they belong to a good class and discarded if they belong to a bad class. In other words, particles are selected using a binary filter — they either are or are not in a good class.

Most classification jobs in CryoSPARC assign classes a probability of belonging to a class, rather than a binary in or out classification. When using class membership to filter particles, particles are considered to be members of the class *for which they have the highest probability*. Good particles ideally have a high probability of belonging to one class and a low probability of belonging to all others.

For example, the top two particles images in the figure at the top of this article have much higher probability of belonging to the cone or cube (respectively) than any other class. Filtering particles by their best class is often sufficient for high-quality data.

Consider, on the other hand, a junk particle (the third particle image in the figure at the top of this article). Since it is random noise, it has a relatively low probability of belonging to any class. If it happens by random chance to have the highest probability of belonging to a good class it will still be selected, despite the fact that its probability in that class may be much lower than particles which truly belong to that class. In this example, the junk particle has a probability of `0.26` of belonging to the cube class, which is greater than its probability of belonging to any other class so if we took all particles in the cube class we would also take this junk particle.

The Class Probability Filter job filters particles by their *probability* of belonging to a given class or set of classes, rather than simply by whether they are more likely to belong to a good class than a bad class. Considering the example above again, if we designate the cube and cone as good classes and only keep particles with a 75% or greater chance of belonging to one of those two classes, the good particles will be kept and the junk pick will correctly be discarded.

## Inputs

### Particle stacks

This job accepts particles which have been classified either in [2D Classification](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/particle-curation/job-2d-classification), [A*b-Initio* Reconstruction](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/3d-reconstruction/job-ab-initio-reconstruction), or [Heterogeneous Refinement](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/3d-refinement/job-heterogeneous-refinement). If particles come from a 2D Classification, it is generally best to select good classes in Select 2D Classes first.

## Commonly Adjusted Parameters

This job acts on either 2D or 3D class probabilities. Because of how jobs work under the hood in CryoSPARC, either 3D **or** 2D parameters must be set. Setting both or the wrong parameter will cause the job to fail when it looks for data which is not there.

### 3D Parameters

#### 3D Class Indexes

Indexes of good classes. These can be found in several places, including the output panel. For instance, if the good volumes are labeled “Volume class 0” and “Volume class 2” in the output panel, entering `0,2` for this parameter would select those classes as good and the rest as bad.

#### 3D Class Threshold

Class Probability Filter will keep only particles which have a **total probability**, across all input classes, of this value or greater.

For instance, say we have classified three particles into four classes. Classes 1 and 2 are good classes, and we want to keep any particle that has a **total probability** of being in a good class of 0.6 or better. If we only look at individual probabilities, no particles meet this threshold:

<figure><img src="/files/PTKhanJ380FqZ3Xtcz8H" alt=""><figcaption></figcaption></figure>

However, if we consider the sum of the probability of all good classes (provided by `3D Class Indexes`), then particles 2 and 3 both clear the threshold of 0.6:

<figure><img src="/files/LfO96VHdfvnjZlCCRSVk" alt=""><figcaption></figcaption></figure>

### 2D Parameters

#### 2D Class Threshold

Class Probability Filter will keep only particles which have a **probability in their best class** of at least this value.

For instance, if the input particles are classified into four classes A, B, C, and D and this parameter was set to `0.9`, a particle would be kept if its probabilities were `0.95, 0.01, 0.01, 0.00` but not `0.4, 0.3, 0.2, 0.0`. Note that there is no way to know whether this high probability comes from a good or bad class. Class Probability Filter selects particles based on the confidence of their assignment, not the quality of the class they are assigned to.

{% hint style="info" %}
To select particles confidently assigned to good classes, first select good classes using Select 2D Classes, then feed the selected particles into Class Probability Filter.
{% endhint %}

## Outputs

### Selected Particles

Particles with a total probability greater than or equal to the threshold are in this output group, otherwise unchanged.

### Excluded Particles

Particles with a total probability less than the threshold are in this output group, otherwise unchanged.

## Recommended Alternatives

Subset Particles by Statistic, released in CryoSPARC v4.7, performs this analysis when `Subset by` is set to `Class probability - 2D` or `Class probability - 3D`. It can operate with a single threshold (like Class Probability Filter does), or with multiple thresholds. Additionally, it can cluster particles by their class probability with a Gaussian mixture model. As such, Class Probability Filter is a legacy job in v4.7, and this type of analysis should be performed with Subset Particles by Statistic instead.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/particle-curation/job-class-probability-filter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
