## 組
> 將包含基本類型的PHP數組包裝到數學集的類。
### 創建
要創建Set,請僅使用包含基元的平面數組:
```
use \Phpml\Math\Set;
$set = new Set([1, 2, 2, 3, 1.1, -1, -10]);
$set->toArray();
// return [-10, -1, 1, 1.1, 2, 3]
$set = new Set(['B', '', 'A']);
$set->toArray();
// return ['', 'A', 'B']
```
注入的數組按`SORT_ASC`排序,刪除重復項并重寫索引
*****
### 并集
創建兩個集合的并集:
```
use \Phpml\Math\Set;
$union = Set::union(new Set([1, 3]), new Set([1, 2]));
$union->toArray();
//return [1, 2, 3]
```
*****
### 交集
創建兩個集合的交集:
```
use \Phpml\Math\Set;
$intersection = Set::intersection(new Set(['A', 'C']), new Set(['B', 'C']));
$intersection->toArray();
//return ['C']
```
*****
### 補充
創建兩個集的集合論差異:
```
use \Phpml\Math\Set;
$difference = Set::difference(new Set(['A', 'B', 'C']), new Set(['A']));
$union->toArray();
//return ['B', 'C']
```
*****
### 添加元素
```
use \Phpml\Math\Set;
$set = new Set([1, 2]);
$set->addAll([3]);
$set->add(4);
$set->toArray();
//return [1, 2, 3, 4]
```
*****
### 刪除元素
```
use \Phpml\Math\Set;
$set = new Set([1, 2]);
$set->removeAll([2]);
$set->remove(1);
$set->toArray();
//return []
```
*****
### 檢查成員
```
use \Phpml\Math\Set;
$set = new Set([1, 2]);
$set->containsAll([2, 3]);
//return false
$set->contains(1);
//return true
```
*****
### 基數
```
use \Phpml\Math\Set;
$set = new Set([1, 2]);
$set->cardinality();
//return 2
```
*****
### 是否為空
```
use \Phpml\Math\Set;
$set = new Set();
$set->isEmpty();
//return true
```
*****
### 使用循環
```
use \Phpml\Math\Set;
$set = new Set(['A', 'B', 'C']);
foreach($set as $element) {
echo "$element, ";
}
// echoes A, B, C
```
- 基本介紹
- 關聯規則學習
- 分類
- SVC
- k近鄰算法
- NaiveBayes
- 回歸
- 最小二乘法
- SVR
- 聚類
- k均值聚類算法
- DBSCAN聚類算法
- 公
- 準確性
- 混亂矩陣
- 分類報告
- 工作流程
- 神經網絡
- 交叉驗證
- 隨機拆分
- 分層隨機分裂
- 特征選擇
- 方差閾值
- 特征選擇
- 預處理
- 標準化
- 缺失值補全
- 特征提取(自然語言)
- 令牌計數矢量化器(文本處理)
- Tf-idf轉換
- 數據集
- ArrayDataset
- CsvDataset
- FilesDataset
- SvmDataset
- MnistDataset
- 準備使用數據集
- Iris Dataset
- Wine Dataset
- Glass Dataset
- 模型管理
- 數學
- 距離
- 矩陣
- 組
- 統計