Updated to add logistic regression godot example
This commit is contained in:
parent
63426281fe
commit
9308b83af4
50 changed files with 101078 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
extends Node2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
print("hello")
|
||||
|
||||
# Use existing node
|
||||
print($CustomKomputeNode.get_total())
|
||||
|
||||
$CustomKomputeNode.add(10)
|
||||
print($CustomKomputeNode.get_total())
|
||||
|
||||
$CustomKomputeNode.add(10)
|
||||
print($CustomKomputeNode.get_total())
|
||||
|
||||
# Create new instance
|
||||
var s = KomputeSummatorNode.new()
|
||||
|
||||
# This will print 0 as it's a new instance
|
||||
print(s.get_total())
|
||||
|
||||
# Now we can again send further commands
|
||||
s.add(10)
|
||||
print(s.get_total())
|
||||
|
||||
s.add(10)
|
||||
print(s.get_total())
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
extends Node2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
var xi = [0, 1, 1, 1, 1, 1]
|
||||
var xj = [0, 0, 0, 1, 1, 1]
|
||||
|
||||
var y_train_1 = [0, 0, 0, 1, 1, 1]
|
||||
|
||||
print("Training with " + str(y_train_1))
|
||||
$KomputeNode.train(y_train_1, xi, xj)
|
||||
|
||||
print("Now running prediction with " + str(xi) + " and " + str(xj))
|
||||
print($KomputeNode.predict(xi, xj))
|
||||
|
||||
# We can also reference the class as named in editor
|
||||
# and create a new instance
|
||||
var s = KomputeSummator.new()
|
||||
|
||||
# We can use a new prediciton value to see how weights change
|
||||
var y_train_2 = [0, 0, 1, 1, 1, 1]
|
||||
|
||||
print("\nTraining with " + str(y_train_2))
|
||||
s.train(y_train_2, xi, xj)
|
||||
|
||||
print("Now running prediction with " + str(xi) + " and " + str(xj))
|
||||
print(s.predict(xi, xj))
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://godot_resources/scripts/KomputeNativeLibrary.gdnlib" type="GDNativeLibrary" id=1]
|
||||
|
||||
[resource]
|
||||
class_name = "KomputeSummator"
|
||||
library = ExtResource( 1 )
|
||||
script_class_name = "KomputeSummator"
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[general]
|
||||
|
||||
singleton=false
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
reloadable=false
|
||||
|
||||
[entry]
|
||||
|
||||
Windows.64="res://gdnative_shared/build/Release/kompute_godot.dll"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Windows.64=[ ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue