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

modify function signatures to allow passing back errors #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jjYBdx4IL
Copy link

Fixes #69

@joelself
Copy link
Contributor

This is completely superfluous because the struct fann_train_data can be cast to a fann_error:

/* Struct: struct fann_error

    Structure used to store error-related information, both
    <struct fann> and <struct fann_train_data> can be casted to this type.

    See also:
        <fann_set_error_log>, <fann_get_errno>
*/

If you want to get the error do something like this:

struct fann_train_data *data = fann_read_train_from_file(filename);
struct fann_error *err = (struct fann_error *)data;
if(err->errno_f != FANN_E_NO_ERROR) {
    // do something
}

Or use one of the many errno functions in fann_error.c .

…ann->errno_f if reading training data from file failed
@jjYBdx4IL
Copy link
Author

jjYBdx4IL commented Jun 17, 2016

okay, I now changed the patch to a minimal, non-API-changing modification. It just sets ann->errno_f after failing to load training data. It's not the exact error and there is no error message, but at least we can detect an error now by reading errno_f.

@bukka
Copy link
Member

bukka commented May 19, 2018

I would suggest to use fann_error and possibly create a new error type for that purpose so it's more consistent and also the message is set.

@andersfylling
Copy link
Contributor

andersfylling commented Jun 2, 2018

We should probably review PR #80(?) and get it working, as it supports a new way to handle errors.

Edit: Ignore this comment.

@troiganto
Copy link

@andersfylling, what do you mean by "new way to handle errors"? I went through the PR you mention and could only find a commit mentioning the "error function", i.e. the function that is minimized during training.

I agree that it would be nice if we could make error handling more consistent and programmatic in FANN, without output to stderr. This PR might be a good first step for it. (I haven't reviewed it though, so I might be wrong.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fann_train_on_file does not set error on bad input training file data
5 participants