Skip to content

fix: fix the validation_pack when multiple input#1212

Merged
SanftMonster merged 3 commits intoSciSharp:masterfrom
Wanglongzhi2001:fix_validation_data_pack
Nov 7, 2023
Merged

fix: fix the validation_pack when multiple input#1212
SanftMonster merged 3 commits intoSciSharp:masterfrom
Wanglongzhi2001:fix_validation_data_pack

Conversation

@Wanglongzhi2001
Copy link
Contributor

@Wanglongzhi2001 Wanglongzhi2001 commented Nov 7, 2023

fix #1211

IEnumerable<Tensor> x,
Tensor y,
int verbose = 1,
NDArray sample_weight = null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's recommended to put sample_weight the last parameter, to keep its backward compatibility. However if this is exactly the order in python, just keeping it is okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it follow the order in python.

public class ValidationDataPack
{
public NDArray val_x;
public OneOf<NDArray, NDArray[]> val_x;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use NDArray[] alone since NDArray could also be an array of length 1? The purpose is to avoid too many APIs with Oneof exposed to users. If this method is not supposed to be used by our users, I think it's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only usage of ValidationPack class is to handle the case that the validation_data parameter in model.fit could be a tuple of two NDArray or three NDArray and deconstruct to two NDArray or three NDArray. So it will not used by users.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider declaring it as internal, which prevents being called from users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, really thank you for your advice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the usage of ValidationPack class limited to internal developers? Therefore I think we should declare the whole class as internal.

Copy link
Contributor Author

@Wanglongzhi2001 Wanglongzhi2001 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried, but it is used in model.fit as a parameter, which is public, so it will cause an error : Inconsistent accessibility: parameter type 'type' is less accessible than method 'method' if declare it as internal.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, no problem

@SanftMonster SanftMonster merged commit ee004c0 into SciSharp:master Nov 7, 2023
@Wanglongzhi2001 Wanglongzhi2001 deleted the fix_validation_data_pack branch November 9, 2023 13:58
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.

[BUG Report]: v0.150.0 breaks multi-input models fit

2 participants