mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
5f4552391f
# Add SKLearnVectorStore This PR adds SKLearnVectorStore, a simply vector store based on NearestNeighbors implementations in the scikit-learn package. This provides a simple drop-in vector store implementation with minimal dependencies (scikit-learn is typically installed in a data scientist / ml engineer environment). The vector store can be persisted and loaded from json, bson and parquet format. SKLearnVectorStore has soft (dynamic) dependency on the scikit-learn, numpy and pandas packages. Persisting to bson requires the bson package, persisting to parquet requires the pyarrow package. ## Before submitting Integration tests are provided under `tests/integration_tests/vectorstores/test_sklearn.py` Sample usage notebook is provided under `docs/modules/indexes/vectorstores/examples/sklear.ipynb` Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
24 lines
718 B
Markdown
24 lines
718 B
Markdown
# scikit-learn
|
|
|
|
This page covers how to use the scikit-learn package within LangChain.
|
|
It is broken into two parts: installation and setup, and then references to specific scikit-learn wrappers.
|
|
|
|
## Installation and Setup
|
|
|
|
- Install the Python package with `pip install scikit-learn`
|
|
|
|
## Wrappers
|
|
|
|
### VectorStore
|
|
|
|
`SKLearnVectorStore` provides a simple wrapper around the nearest neighbor implementation in the
|
|
scikit-learn package, allowing you to use it as a vectorstore.
|
|
|
|
To import this vectorstore:
|
|
|
|
```python
|
|
from langchain.vectorstores import SKLearnVectorStore
|
|
```
|
|
|
|
For a more detailed walkthrough of the SKLearnVectorStore wrapper, see [this notebook](../modules/indexes/vectorstores/examples/sklearn.ipynb).
|