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

fix: shift examples around

Was failing because two package names appeared in the same directory
This commit is contained in:
Richard Townsend 2020-09-07 21:37:18 +01:00
parent c39ef5156b
commit b015e072ba
2 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,6 @@ import (
"github.com/sjwhitworth/golearn/base"
"github.com/sjwhitworth/golearn/trees"
)
func main() {
@ -37,7 +36,7 @@ func main() {
*/
// Load Titanic Data For classification
classificationData, err := base.ParseCSVToInstances("../datasets/titanic.csv", false)
classificationData, err := base.ParseCSVToInstances("../../datasets/titanic.csv", false)
if err != nil {
panic(err)
}
@ -45,7 +44,7 @@ func main() {
// Create New Classification Tree
// Hyperparameters - loss function, max Depth (-1 will split until pure), list of unique labels
decTree := NewDecisionTreeClassifier("entropy", -1, []int64{0, 1})
decTree := trees.NewDecisionTreeClassifier("entropy", -1, []int64{0, 1})
// Train Tree
err = decTree.Fit(trainData)
@ -65,14 +64,14 @@ func main() {
fmt.Println(decTree.Evaluate(testData))
// Load House Price Data For Regression
regressionData, err := base.ParseCSVToInstances("../datasets/boston_house_prices.csv", false)
regressionData, err := base.ParseCSVToInstances("../../datasets/boston_house_prices.csv", false)
if err != nil {
panic(err)
}
trainRegData, testRegData := base.InstancesTrainTestSplit(regressionData, 0.5)
// Hyperparameters - Loss function, max Depth (-1 will split until pure)
regTree := NewDecisionTreeRegressor("mse", -1)
regTree := trees.NewDecisionTreeRegressor("mse", -1)
// Train Tree
err = regTree.Fit(trainRegData)

View File

@ -4,12 +4,13 @@ package main
import (
"fmt"
"math/rand"
"github.com/sjwhitworth/golearn/base"
"github.com/sjwhitworth/golearn/ensemble"
"github.com/sjwhitworth/golearn/evaluation"
"github.com/sjwhitworth/golearn/filters"
"github.com/sjwhitworth/golearn/trees"
"math/rand"
)
func main() {
@ -19,7 +20,7 @@ func main() {
rand.Seed(44111342)
// Load in the iris dataset
iris, err := base.ParseCSVToInstances("../datasets/iris_headers.csv", true)
iris, err := base.ParseCSVToInstances("../../datasets/iris_headers.csv", true)
if err != nil {
panic(err)
}