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

Slightly negative score causes Python lib error #17

Closed
uncopied opened this issue Aug 23, 2021 · 2 comments
Closed

Slightly negative score causes Python lib error #17

uncopied opened this issue Aug 23, 2021 · 2 comments

Comments

@uncopied
Copy link

It appears that the issue with the score (i.e., halting the output) lies within the following function within BatchFirstLastNameUSRaceEthnicityOut (within the openapi client module's models) :

def score(self, score):

        """Sets the score of this FirstLastNameUSRaceEthnicityOut.



        Higher score is better, but score is not normalized. Use calibratedProbability if available.   # noqa: E501



        :param score: The score of this FirstLastNameUSRaceEthnicityOut.  # noqa: E501

        :type: float

        """

        if score is not None and score > 100:  # noqa: E501

            raise ValueError("Invalid value for `score`, must be a value less than or equal to `100`")  # noqa: E501

        if score is not None and score < 0:  # noqa: E501

            raise ValueError("Invalid value for `score`, must be a value greater than or equal to `0`")  # noqa: E501



        self._score = score

I tried again on progressively smaller batches and then tried to enter a couple of names on the namsor site for a sanity check - it turns out that some of the names output a negative score (for example, see attached scores). Note that both appear to be hispanic predictions which I saw caused a bug in earlier iterations (per some commit notes on your github).

@uncopied
Copy link
Author

Thank you. We have identified the root cause, where ~3% of scores go outside of the 0-100 boundary with a value slightly below 0 - which triggers an error in the API sanity check. This has been fixed in development and will be released on 25th/26th September during our next release.

Meanwhile, as a quickfix, we propose to comment out the lines raising the error :
if score is not None and score > 100: # noqa: E501
raise ValueError("Invalid value for score, must be a value less than or equal to 100") # noqa: E501
if score is not None and score < 0: # noqa: E501
raise ValueError("Invalid value for score, must be a value greater than or equal to 0") # noqa: E501

Sorry about this and thanks for reporting the error,

@uncopied
Copy link
Author

Fixed in v2.0.16

namsor added a commit that referenced this issue Jun 19, 2023
NamSorAPIv2.0.26 (2023-06-18)

added option to return country religion statistics for taxonomies Origin/Country/Diaspora, with header X-OPTION-RELIGION-STATS=True
improved AI explainability for Enterprise users (API Key should be set to Explainability=True and API queries with header X-OPTION-EXPLAINABILITY=True)
replaced JNBC with gotyai-java
further improved free account abuse/spam detection

NamSorAPIv2.0.25 (2023-05-20)

fixed Italian names issue ex Andrea/Rossini (#23)
added AI explainability for Enterprise users (API Key should be set to Explainability=True and API queries with header X-OPTION-EXPLAINABILITY=True)
improved some logging features as well as other internal services (free account abuse/spam detection)

NamSorAPIv2.0.24 (2023-03-12)

Added specific endpoints for Indian names : Indian State subclassification, Religion (Hindu, Muslim, Jain, Christian), Caste Category (General, ST, SC, OST)
Other improvements on Latin American countries, Portuguese and Spanish names

NamSorAPIv2.0.23 (2023-01-15)

Improvements for Indian names sub-classification
New taxonomies for Indian names : Religion, Caste Category (General, ST, SC, OST)

NamSorAPIv2.0.22 (2022-12-17)

Improvements on names in ARABIC (gender, origin, country)
Improvements for Indian names sub-classification
Other improvements : Malaysia, Indonesia, Brasil/Portugal, Spain/LatAm

NamSorAPIv2.0.21 (2022-09-25)

Added mandatory email verification before activation of API Key due to abuse
Improvements for Indian names gender classification
Improvements for classification of Italian names with US "Race"/Ethnicity (issue not full resolved, current recommendation is to combine with Diaspora model)

NamSorAPIv2.0.20 (2022-07-28)

Diaspora model enhancements for 7 European countries Italy (IT),France (FR), Germany (DE), Ireland (IE), Netherlands (NL), Belgium (BE), Spain (ES).
Added an open endpoint to query the list of countries/regions
Minor back-end changes to support features of the new front-end version namsor.app
Added OPTIONS to CORS for ethnicity-estimate.com

NamSorAPIv2.0.19 (2022-05-08)

Fixed rare issue with NaN score/probability
Improvements for Minorities/Diversity Analytics in Italy
No major change to API (still at v2.namsor.com)
Added OPTIONS to CORS for gender-guesser.com

NamSorAPIv2.0.18 (2022-01-16)

Second batch of improvements on CYRILLIC : Diaspora
No major change to API (still at v2.namsor.com), but we're now redirecting namsor.com front-end to the new version namsor.app
Added a gender endpoint for just given names (defaulting to 'US' local context)
Fixed Stripe redirect
Fixed ParseName issue when not trimmed()
Added X-OPTION-USRACEETHNICITY-TAXONOMY to CORS

NamSorAPIv2.0.17 (2021-12-05)

First batch of improvements on CYRILLIC : Origin, Country and Gender

NamSorAPIv2.0.16 (2021-09-26)

Diaspora model now has calibratedProbability/calibratedProbabilityAlt as the other models (Gender, Country, Origin, US 'Race'/Ethnicity) based on ability to predict either (A) the Diaspora country of birth or (B) the name country of Origin (ie. consistency with NamSor Origin model).
Various admin API enhancements to support the new Website and CSV tool
[BugFix] Slightly negative score were causing Python lib error #17
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

No branches or pull requests

1 participant