Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: FluidMLPRegressor's .fit method evaluating 'action' before finishing #167

Open
mccrmck opened this issue Sep 6, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mccrmck
Copy link

mccrmck commented Sep 6, 2023

Please tell us what you were doing! You can include code and files by drag and dropping them into the text area.

Trying to .dump a DataSet as an action function FluidMLPRegressor's .fit method consistently throws an error:

// create some resources
(
~makeDict = { Dictionary.newFrom(["cols",1,"data",Dictionary.newFrom(200.collect({ |i| [i, [1.0.rand]] }).flatten(1) ) ]) };
~inDS = FluidDataSet(s).load( ~makeDict.value );
~outDS = FluidDataSet(s).load( ~makeDict.value );
~mlp = FluidMLPRegressor(s);
)

// run this:
(
fork{
	2.do{
		~mlp.fit(~inDS,~outDS,{
			~outDS.dump({ |d| d["data"]["0"].dopostln })
		});
		0.01.wait;
	}
}
)

What was the expected result?

The help file describes the action argument as "A function to execute when the server has completed running fit," though it seems it's being executed sooner than that. I ran similar tests on a few other FluidDataObjects and their methods (though not exhaustively) and experienced the same errors.

What was the actual result?

It seems like .dump is trying to access a File that isn't finished writing yet, implying that .dump is being called before .fit has finished.

ERROR: Primitive '_FileLength' failed.
Failed.
RECEIVER:
Instance of File {    (0x1409cfa88, gc=E0, fmt=00, flg=00, set=02)
  instance variables [1]
    fileptr : nil
}

PROTECTED CALL STACK:
	Meta_MethodError:new	0x150922880
		arg this = PrimitiveFailedError
		arg what = Failed.
		arg receiver = a File
	Meta_PrimitiveFailedError:new	0x15092a740
		arg this = PrimitiveFailedError
		arg receiver = a File
	Object:primitiveFailed	0x1602991c0
		arg this = a File
	File:readAllString	0x151c16740
		arg this = a File
		var string = nil
	a FunctionDef	0x151c0f680
		sourceCode = "<an open Function>"
		arg file = a File
	Function:prTry	0x150d53c00
		arg this = a Function
		var result = nil
		var thread = a Thread
		var next = nil
		var wasInProtectedFunc = false
	
CALL STACK:
	MethodError:reportError
		arg this = <instance of PrimitiveFailedError>
	Nil:handleError
		arg this = nil
		arg error = <instance of PrimitiveFailedError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of PrimitiveFailedError>
	Object:throw
		arg this = <instance of PrimitiveFailedError>
	Function:protect
		arg this = <instance of Function>
		arg handler = <instance of Function>
		var result = <instance of PrimitiveFailedError>
	Meta_File:readAllString
		arg this = <instance of Meta_File>
		arg pathName = "/Users/mikemccormick/Library..."
		var string = nil
	< FunctionDef in Method FluidDataObject:dump >  (no arguments or variables)
	OSCFuncAddrMessageMatcher:value
		arg this = <instance of OSCFuncAddrMessageMatcher>
		arg msg = [*2]
		arg time = 2063.391093209
		arg testAddr = <instance of NetAddr>
		arg recvPort = 57120
	Dictionary:keysValuesArrayDo
		arg this = <instance of IdentityDictionary>
		arg argArray = [*32]
		arg function = <instance of Function>
		var i = 20
		var j = 1
		var key = nil
		var val = nil
		var arraySize = nil
	Dictionary:keysValuesDo
		arg this = <instance of IdentityDictionary>
		arg function = <instance of Function>
	FluidOSCPatternInversion:value
		arg this = <instance of FluidOSCPatternInversion>
		arg msg = [*2]
		arg time = 2063.391093209
		arg addr = <instance of NetAddr>
		arg recvPort = 57120
		var msgpath = '/FluidDataSet/write'
	< FunctionDef in Method Collection:collectInPlace >
		arg item = <instance of FluidOSCPatternInversion>
		arg i = 2
	ArrayedCollection:do
		arg this = [*5]
		arg function = <instance of Function>
		var i = 2
	Collection:collectInPlace
		arg this = [*5]
		arg function = <instance of Function>
	FunctionList:value
		arg this = <instance of FunctionList>
		arg args = [*4]
		var res = nil
	Main:recvOSCmessage
		arg this = <instance of Main>
		arg time = 2063.391093209
		arg replyAddr = <instance of NetAddr>
		arg recvPort = 57120
		arg msg = [*2]
^^ The preceding error dump is for ERROR: Primitive '_FileLength' failed.
Failed.
RECEIVER: a File

What operating system were you using?

Mac

Operating system version

macOS 13.5

FluCoMa Version

1.0.6

@mccrmck mccrmck added the bug Something isn't working label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant