1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-26 13:49:14 +08:00

Merge pull request #120 from EtienneBruines/master

Updated Dot and Sum methods according to changes in gonum/matrix.
This commit is contained in:
Richard Townsend 2015-09-25 19:03:32 +01:00
commit 6ed783530a
3 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ func NewEuclidean() *Euclidean {
// InnerProduct computes a Eucledian inner product.
func (e *Euclidean) InnerProduct(vectorX *mat64.Dense, vectorY *mat64.Dense) float64 {
result := vectorX.Dot(vectorY)
result := mat64.Dot(vectorX, vectorY)
return result
}

View File

@ -18,7 +18,7 @@ func NewPolyKernel(degree int) *PolyKernel {
// InnerProduct computes the inner product through a kernel trick
// K(x, y) = (x^T y + 1)^d
func (p *PolyKernel) InnerProduct(vectorX *mat64.Dense, vectorY *mat64.Dense) float64 {
result := vectorX.Dot(vectorY)
result := mat64.Dot(vectorX, vectorY)
result = math.Pow(result+1, float64(p.degree))
return result

View File

@ -322,7 +322,7 @@ func (m *MultiLayerNet) Fit(X base.FixedDataGrid) {
}
// Update total error
totalError += math.Abs(errVec.Sum())
totalError += math.Abs(mat64.Sum(errVec))
// Back-propagate the error
b := m.network.Error(trainVec, errVec, totalLayers)