question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to transform the normal SecInt data into np format?

See original GitHub issue

I tried to improve the performance using the code in np_*.py. I have encountered a format issue TypeError: can't multiply sequence by non-int of type 'ArraySecInt42'.

T = secint.array(np.ones(n, dtype='O'))
S = [secint.array(np.array([[t[i] == j for t in transactions] for j in attr_ranges[i]]))
         for i in range(d)]
S_A = [[mpc.in_prod([S[k][j][l] for k in RR], ii) for l in range(len(S[0][0]))] for j in range(ell)]
T_SA = T * S_A  # mpc.schur_prod

S_A is a list of normal SecInt data, while T is np format. S_A is 2D list. I tried to use np.concatenate etc. to convert S_A but failed.

The normal version without using np has been tested successfully. If you want to test the np version to check the error, I can provide the code

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DylanWangWQFcommented, Dec 19, 2022

Sure, I will first put the initial result for the binary case here. (avg 5 times here) 截屏2022-12-20 11 18 13

Yeah, great, maybe you can also report the timings that you get for both versions here?

Yes, as you said, it’s not hard to add. I will do it later since I have some deadlines recently.

And it would be nice to cover the nonbinary case for the class attribute. I don’t think that’s hard to add. Then all datasets in demos/data/id3 can be used as is. For that also the case that the class attribute is not the last one needs to be handled, as the above code simply appends a 0 to the unit vector k.

0reactions
lschoecommented, Dec 19, 2022

Yeah, great, maybe you can also report the timings that you get for both versions here?

And it would be nice to cover the nonbinary case for the class attribute. I don’t think that’s hard to add. Then all datasets in demos/data/id3 can be used as is. For that also the case that the class attribute is not the last one needs to be handled, as the above code simply appends a 0 to the unit vector k.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pretty-print a NumPy array without scientific notation and with ...
Here is how I print a simple 2D array using some variety in the formatting by converting (slices of) my NumPy array to...
Read more >
Chapter 4. NumPy Basics: Arrays and Vectorized Computation
Fast vectorized array operations for data munging and cleaning, subsetting and filtering, transformation, and any other kinds of computations. Common array ...
Read more >
How to Save a NumPy Array to File for Machine Learning
1. Save NumPy Array to .CSV File (ASCII). The most common file format for storing numerical data in files is the comma-separated variable ......
Read more >
The 10 Best Ways to Create NumPy Arrays
First, import the libraries we'll need under their usual aliases. ... You can convert a list into a NumPy array with the array...
Read more >
Change data type of given numpy array - GeeksforGeeks
In order to change the dtype of the given array object, we will use numpy.astype() function. The function takes an argument which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found