semvec/pypi-packages huggingface dataset:
zdppy-elasticsearch 1.0.1
python操作ElasticSearch的基础组件
License: MIT
Requires Python: >=3.9,<4.0
Keywords: zdppy,ElasticSearch,search,zhangdapeng

# zdppy_elasticsearch库使用
项目地址
GitHub开源地址：https://github.com/zhangdapeng520/zdppy_elasticsearch

主要看dev分支的代码。

# 版本历史
- 2023/01/30 v1.0.1 使用zdppy_requests完全重构项目

# 快速入门
## 安装
```bash
pip install zdppy_elasticsearch
```

## 创建Mapping
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
body = {
  "mappings": {
    "properties": {
      "name": {
        "type": "text"
      },
      "price": {
        "type": "double"
      },
      "author": {
        "type": "text"
      },
      "pub_date": {
        "type": "date"
      }
    }
  }
}
index = "books"
print(es.add_mapping(index, body))
```

## 查询Mapping
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
print(es.get_mapping(index))
```

## 删除Mapping
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
print(es.delete_index(index))
```

## 根据ID新增数据
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
did = 1
body = {
	"name": "《JavaScript全栈开发实战》",
	"author": "张大鹏",
	"price": 123,
	"pub_date": "2019-12-12"
}
print(es.add(index, did, body))
```

## 根据ID查询图书
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
did = 1
print(es.get(index, did))
print(es.get(index, did, is_source=True))
```

## 根据ID删除图书
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
did = 1
print(es.delete(index, did))
print(es.get(index, did, is_source=True))
```

## 批量插入数据
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
data = [
	{"index": {"_index": "books", "_type" : "_doc", "_id" : "1"}},
	{"name": "《JavaScript全栈开发实战》", "author": "张大鹏", "price": 123, "pub_date": "2019-12-12" },
	{"index": {"_index": "books", "_type" : "_doc", "_id" : "2"}},
	{"name": "《React学习手册》", "author": "张大鹏", "price": 122, "pub_date": "2019-12-12" },
	{"index": {"_index": "books", "_type" : "_doc", "_id" : "3",}},
	{"name": "《精通Go语言》", "price": 128, "pub_date": "2019-12-12" }
]

data1 = [
	{"name": "《JavaScript全栈开发实战》", "author": "张大鹏", "price": 123, "pub_date": "2019-12-12" },
	{"name": "《React学习手册》", "author": "张大鹏", "price": 122, "pub_date": "2019-12-12" },
	{"name": "《精通Go语言》", "price": 128, "pub_date": "2019-12-12" }
]


# 自定义索引和和ID
print(es.add_many(data))

# 自动生成ID
print(es.add_many(data1, index=index))
```

## 搜索所有图书
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"

# 搜索所有图书
print(es.search(index))
```

## 搜索特定价格范围的图书
```python
import zdppy_elasticsearch as ze

es = ze.ElasticSearch(password="zhangdapeng520")
index = "books"
query = {
  "query": {
    "range": {
      "price": {
        "gt": 123,
        "lte": 130
      }
    }
  }
}

# 搜索所有图书
print(es.search(index, query))
```
ruleslabs-periphery 0.2.0
Periphery smart contracts used by rules.
License: MIT

# Rules periphery contracts

The Account and Proxy contracts used by rules

## Local development

### Compile contracts

```bash
nile compile --account_contract contracts/account/Account.cairo
nile compile contracts/proxy/Proxy.cairo
```

### Run tests

```bash
pytest tests/account.py
```

## Credits

The account contract is inspired by [argentlabs/argent-contracts-starknet](https://github.com/argentlabs/argent-contracts-starknet)
baby-shap 0.0.6
A stripped and opiniated version of Scott Lundberg's SHAP (SHapley Additive exPlanations)
License: MIT
Requires Python: >=3.10
Keywords: shap



<p align="center">
  <img src="https://raw.githubusercontent.com/slundberg/shap/master/docs/artwork/shap_header.svg" width="800" />
</p>

---
![example workflow](https://github.com/thomhopmans/baby-shap/actions/workflows/run_tests.yml/badge.svg)

Baby Shap is a stripped and opiniated version of **SHAP (SHapley Additive exPlanations)**, a game theoretic approach to explain the output of any machine learning model by Scott Lundberg. It connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions (see [papers](#citations) for details and citations). 

**Baby Shap solely implements and maintains the Linear and Kernel Explainer and a limited range of plots, while limiting the number of dependencies, conflicts and raised warnings and errors.**

## Install

Baby SHAP can be installed from either [PyPI](https://pypi.org/project/baby-shap):

<pre>
pip install baby-shap
</pre>

## Model agnostic example with KernelExplainer (explains any function)

Kernel SHAP uses a specially-weighted local linear regression to estimate SHAP values for any model. Below is a simple example for explaining a multi-class SVM on the classic iris dataset.

```python
import baby_shap
from sklearn import datasets, svm, model_selection

# print the JS visualization code to the notebook
baby_shap.initjs()

# train a SVM classifier
d = datasets.load_iris()
X = pd.DataFrame(data=d.data, columns=d.feature_names)
y = d.target

X_train, X_test, Y_train, Y_test = model_selection.train_test_split(X, y, test_size=0.2, random_state=0)
clf = svm.SVC(kernel='rbf', probability=True)
clf.fit(X_train.to_numpy(), Y_train)

# use Kernel SHAP to explain test set predictions
explainer = baby_shap.KernelExplainer(svm.predict_proba, X_train, link="logit")
shap_values = explainer.shap_values(X_test, nsamples=100)

# plot the SHAP values for the Setosa output of the first instance
baby_shap.force_plot(explainer.expected_value[0], shap_values[0][0,:], X_test.iloc[0,:], link="logit")
```
<p align="center">
  <img width="810" src="https://raw.githubusercontent.com/slundberg/shap/master/docs/artwork/iris_instance.png" />
</p>

The above explanation shows four features each contributing to push the model output from the base value (the average model output over the training dataset we passed) towards zero. If there were any features pushing the class label higher they would be shown in red.

If we take many explanations such as the one shown above, rotate them 90 degrees, and then stack them horizontally, we can see explanations for an entire dataset. This is exactly what we do below for all the examples in the iris test set:

```python
# plot the SHAP values for the Setosa output of all instances
baby_shap.force_plot(explainer.expected_value[0], shap_values[0], X_test, link="logit")
```
<p align="center">
  <img width="813" src="https://raw.githubusercontent.com/slundberg/shap/master/docs/artwork/iris_dataset.png" />
</p>