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

OSError: Windows isn't supported yet #77

Open
wbadry opened this issue Jul 21, 2020 · 3 comments
Open

OSError: Windows isn't supported yet #77

wbadry opened this issue Jul 21, 2020 · 3 comments

Comments

@wbadry
Copy link

wbadry commented Jul 21, 2020

Hello,
Is there a problem with integrity_score?

# Porting
porter = Porter(svc_model, language='c')

# Calculate Integrity Score
integrity = porter.integrity_score(standardized_features_frame)

# Print score
print(integrity)

# Export C code
output = porter.export()

# Print C code
print(output)

I receive the following error:

File "C:\Python37\lib\site-packages\sklearn_porter\utils\Environment.py", line 75, in _platform_is_windows
    raise OSError(error_msg)
OSError: Windows isn't supported yet

When I remove integrity_score, the code is generated with no problems (only few warnings about depreciated code)

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

double coefficients[20] = {0.1391771356565354, 1.828258932194222, -0.3831725164267214, -1.103367573526621, -0.604291863892225, 0.5723835669074493, -0.34479887417147226, -0.8434799759703641, 0.3676324195239303, 0.3447426771538185, 0.19490918797363005, -0.3170564194138528, -0.3170564194138528, 0.267201742046325, 0.8137154349144415, 0.15804220719981077, 0.1490377305630668, 0.9058368625295317, -0.6680424130685098, 0.2836290565184824};
double intercepts = -0.04981732672437096;

int predict (float features[]) {
    int i, l;
    double prob = 0.;
    for (i = 0, l = sizeof(coefficients) / sizeof (coefficients[0]); i < l; i++) {
        prob += coefficients[i] * features[i];
    }
    if (prob + intercepts > 0) {
        return 1;
    }
    return 0;
}

int main(int argc, const char * argv[]) {

    /* Features: */
    float features[argc-1];
    int i;
    for (i = 1; i < argc; i++) {
        features[i-1] = atof(argv[i]);
    }

    /* Prediction: */
    printf("%d", predict(features));
    return 0;

}

I don't understand what is the difference between Windows and Linux in getting this function to work 😄 .

Thanks

@nithinreddyy
Copy link

Hello,
Is there a problem with integrity_score?

# Porting
porter = Porter(svc_model, language='c')

# Calculate Integrity Score
integrity = porter.integrity_score(standardized_features_frame)

# Print score
print(integrity)

# Export C code
output = porter.export()

# Print C code
print(output)

I receive the following error:

File "C:\Python37\lib\site-packages\sklearn_porter\utils\Environment.py", line 75, in _platform_is_windows
    raise OSError(error_msg)
OSError: Windows isn't supported yet

When I remove integrity_score, the code is generated with no problems (only few warnings about depreciated code)

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

double coefficients[20] = {0.1391771356565354, 1.828258932194222, -0.3831725164267214, -1.103367573526621, -0.604291863892225, 0.5723835669074493, -0.34479887417147226, -0.8434799759703641, 0.3676324195239303, 0.3447426771538185, 0.19490918797363005, -0.3170564194138528, -0.3170564194138528, 0.267201742046325, 0.8137154349144415, 0.15804220719981077, 0.1490377305630668, 0.9058368625295317, -0.6680424130685098, 0.2836290565184824};
double intercepts = -0.04981732672437096;

int predict (float features[]) {
    int i, l;
    double prob = 0.;
    for (i = 0, l = sizeof(coefficients) / sizeof (coefficients[0]); i < l; i++) {
        prob += coefficients[i] * features[i];
    }
    if (prob + intercepts > 0) {
        return 1;
    }
    return 0;
}

int main(int argc, const char * argv[]) {

    /* Features: */
    float features[argc-1];
    int i;
    for (i = 1; i < argc; i++) {
        features[i-1] = atof(argv[i]);
    }

    /* Prediction: */
    printf("%d", predict(features));
    return 0;

}

I don't understand what is the difference between Windows and Linux in getting this function to work 😄 .

Thanks

Did it work on windows dude?

@wbadry
Copy link
Author

wbadry commented Sep 2, 2020

@nithinreddyy it does without any problem. I only suspect that the error message is shown with any exception even if platform is not the reason 😄

@nok
Copy link
Owner

nok commented May 16, 2022

Hello @wbadry ,

thanks for your question and hint. Until now it's not supported, because I couldn't cover it with unit tests. My plan is to replace the excpetion with a simple warning.

Kind regards,
Darius

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

No branches or pull requests

3 participants