## 矩陣
> 將PHP數組包裝到數學矩陣的類。
### 創建
要創建Matrix,請使用簡單數組:
```
$matrix = new Matrix([
[3, 3, 3],
[4, 2, 1],
[5, 6, 7],
]);
```
您還可以從平面陣列創建Matrix(一維):
```
$flatArray = [1, 2, 3, 4];
$matrix = Matrix::fromFlatArray($flatArray);
```
*****
### 矩陣數據
從`Matrix`讀取數據的方法:
```
$matrix->toArray(); // cast matrix to PHP array
$matrix->getRows(); // rows count
$matrix->getColumns(); // columns count
$matrix->getColumnValues($column=4); // get values from given column
```
*****
### 行列式
閱讀有關[矩陣行列式](https://baike.baidu.com/item/%E7%9F%A9%E9%98%B5%E8%A1%8C%E5%88%97%E5%BC%8F/18882017?fr=aladdin)的更多信息
```
$matrix = new Matrix([
[3, 3, 3],
[4, 2, 1],
[5, 6, 7],
]);
$matrix->getDeterminant();
// return -3
```
*****
### 顛倒
閱讀有關[矩陣轉置](https://baike.baidu.com/item/%E7%9F%A9%E9%98%B5%E8%BD%AC%E7%BD%AE/4150715?fr=aladdin)的更多信息。
```
$matrix->transpose();
// return new Matrix
```
*****
### 乘
由另一個矩陣乘以矩陣。
```
$matrix1 = new Matrix([
[1, 2, 3],
[4, 5, 6],
]);
$matrix2 = new Matrix([
[7, 8],
[9, 10],
[11, 12],
]);
$matrix1->multiply($matrix2);
// result $product = [
// [58, 64],
// [139, 154],
//];
```
*****
### 除以標量
您可以通過標量值劃分`Matrix`。
```
$matrix->divideByScalar(2);
```
*****
### 逆
閱讀有關[可逆矩陣](https://baike.baidu.com/item/%E5%8F%AF%E9%80%86%E7%9F%A9%E9%98%B5/11035614)的更多信息
```
$matrix = new Matrix([
[3, 4, 2],
[4, 5, 5],
[1, 1, 1],
]);
$matrix->inverse();
// result $inverseMatrix = [
// [0, -1, 5],
// [1 / 2, 1 / 2, -7 / 2],
// [-1 / 2, 1 / 2, -1 / 2],
//];
```
*****
### 劃出
從`Matrix`中劃出給定的行和列。
```
$matrix = new Matrix([
[3, 4, 2],
[4, 5, 5],
[1, 1, 1],
]);
$matrix->crossOut(1, 1)
// result $crossOuted = [
// [3, 2],
// [1, 1],
//];
```
- 基本介紹
- 關聯規則學習
- 分類
- SVC
- k近鄰算法
- NaiveBayes
- 回歸
- 最小二乘法
- SVR
- 聚類
- k均值聚類算法
- DBSCAN聚類算法
- 公
- 準確性
- 混亂矩陣
- 分類報告
- 工作流程
- 神經網絡
- 交叉驗證
- 隨機拆分
- 分層隨機分裂
- 特征選擇
- 方差閾值
- 特征選擇
- 預處理
- 標準化
- 缺失值補全
- 特征提取(自然語言)
- 令牌計數矢量化器(文本處理)
- Tf-idf轉換
- 數據集
- ArrayDataset
- CsvDataset
- FilesDataset
- SvmDataset
- MnistDataset
- 準備使用數據集
- Iris Dataset
- Wine Dataset
- Glass Dataset
- 模型管理
- 數學
- 距離
- 矩陣
- 組
- 統計