mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-26 13:49:14 +08:00
feature: adding attributes
This commit is contained in:
parent
81edd9b55b
commit
b4ebccc0e1
20
doc/pt_BR/Adding-Attributes.md
Normal file
20
doc/pt_BR/Adding-Attributes.md
Normal file
@ -0,0 +1,20 @@
|
||||
```go
|
||||
// Create a new, empty DenseInstances
|
||||
newInst := base.NewDenseInstances()
|
||||
|
||||
// Create some Attributes
|
||||
attrs := make([]base.Attribute, 2)
|
||||
attrs[0] = base.NewFloatAttribute("Arbitrary Float Quantity")
|
||||
attrs[1] = new(base.CategoricalAttribute)
|
||||
attrs[1].SetName("Class")
|
||||
|
||||
// Add the attributes
|
||||
newSpecs := make([]base.AttributeSpec, len(attrs))
|
||||
for i, a := range attrs {
|
||||
newSpecs[i] = newInst.AddAttribute(a)
|
||||
}
|
||||
```
|
||||
|
||||
**Trecho de código: Adicionando dois novos atributos a um `UpdatableDataGrid` em branco**
|
||||
|
||||
* Os atributos só podem ser adicionados a `UpdatableDataGrids` vazios (ou seja, antes de chamar `Extend` para alocar memória)..
|
Loading…
x
Reference in New Issue
Block a user