# Dark Matter

<pre class="language-python" data-overflow="wrap"><code class="lang-python">class DarkMatter(input_column_size: int,
                 task_target_size: int,
                 output_column_size: int,
                 task: str,
                 X: <a data-footnote-ref href="#user-content-fn-1">DarkMatterType</a>,
                 y: <a data-footnote-ref href="#user-content-fn-1">DarkMatterType</a>,
                 <a data-footnote-ref href="#user-content-fn-2">explainability</a>: bool = False,
                 column_names: list[str] | None = None,
                 project_name: str | None = None,
                 max_iter: int = 10_000,
                 batch_size: int | float = 1000)
</code></pre>

## Parameters

### input\_column\_size: *int*

*The total number of input features.*

### output\_column\_size: *int*

*The number of desired output "features" (embedding length). Must be a number between 1 and 500, inclusive.*

### task\_target\_size: *int*

*The total number of targets. Currently, only 1 is supported.*

### task: *str*

*One of "regression" or "classification".*

### X: [*DarkMatterType*](/ensemble-ai-api-docs/dark-matter/darkmattertype.md)

*The input data feature set.*

### y: [*DarkMatterType*](/ensemble-ai-api-docs/dark-matter/darkmattertype.md)

*The input data targets.*

### [explainability](/ensemble-ai-api-docs/references/explainability-mode.md): *bool, default=False*

*Enable/disable* [*explainability mode*](/ensemble-ai-api-docs/references/explainability-mode.md)*.*

### column\_names: *list\[str] | None, default=None*

*Optional feature names for use with explainability mode. If none are specified, either the names are inferred from the X argument if it is a Pandas DataFrame or will be generic names \["feature\_0", "feature\_1", ...].*

### project\_name: *str | None, default=None*

*Optional string for use to save algorithm weights to disk. The default is a "YY-MM-DD\_hh-mm-ss" string based on the environment clock.*

### max\_iter: *int, default=10,000*

*The total number of training iterations to use during algorithm fitting. This must be greater than the sensitivity argument.*

### batch\_size: *int | float = 1000*

*The number of training examples to use for each batch during fitting. Floating point arguments must be a number between 0 and 1 to indicate the percentage of the input data to be used as a batch.*

## Methods

### fit

```python
def fit(self, src_path: str = "./src") -> "DarkMatter"
```

Fits the algorithm to the input data.

### generate

```python
def generate(self, X: Iterable) -> DarkMatterType
```

Transforms a given dataset to embeddings using Dark Matter.

### save

```python
def save(self, *, path: str = "weights", project_name: str | None = None) -> str
```

Saves the algorithm weights to a subfolder `"{path}/{project_name}/"`.

### load

```python
def load(self, *, path: str = "weights", project_name: str | None = None) -> "DarkMatter"
```

Loads the algorithm's weights from a subfolder `"{path}/{project_name}/"`.

## Notes

* NaN values are not compatible with algorithm training, these must be filled prior to calling fit or generate.
* Dark Matter utilizes a variety of Data Science and backend Python packages for algorithm training and source code management. Learn more at [The Dark Matter Environment](/ensemble-ai-api-docs/references/the-dark-matter-environment.md).

## Product Updates Coming Soon

* GPU support.
* Training progress and insights.
* Automatic hyperparameter tuning.

[^1]: [DarkMatterType](/ensemble-ai-api-docs/dark-matter/darkmattertype.md)

[^2]: [Explainability Mode](/ensemble-ai-api-docs/references/explainability-mode.md)


---

# 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://ensemble-ai.gitbook.io/ensemble-ai-api-docs/dark-matter.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.
