GPU Compute Software
Ask questions about Intel® Graphics Compute software technologies, such as OpenCL* GPU driver and oneAPI Level Zero
354 Discussions

Monte Carlo Simulation using OpenVINO

jeanmarieb
Beginner
437 Views

Hello all,

 

I am discovering Data Science and am having a very good time. I don't have lots of mathematic skills . I'm wondering if someone can help kickstart my optimization project. I would like to know if it would be possible to optimize this script so that it benefits from intel vector processors :

By the way, is there a fast alternative to itertools.combinations() in OpenVINO?


Code : 

def monte_carlo_simulation(draws, size):
    combination_counts = {}
    for _ in range(1000000):
        draw = random.choice(draws)
        combinations = itertools.combinations(draw, size)
         for combination in combinations:
            combination = tuple(sorted(combination))
            if combination not in combination_counts:
                combination_counts[combination] = 0
            combination_counts[combination] += 1

Example data :

[[6 7 10 13 15 16 18 22 23 24 26 27 29 31 33 35 37 41 66 68]
[1 2 12 14 19 20 22 24 25 30 35 44 45 47 52 55 56 57 61 67]
[15 19 20 25 30 32 33 35 38 39 40 46 47 48 51 61 62 63 64 70]
[3 5 6 11 14 15 19 22 26 27 34 41 43 45 51 53 56 57 68 69]
[4 6 8 11 14 29 32 33 34 35 38 41 47 51 53 56 58 62 63 64]
[6 12 13 17 19 21 24 25 26 29 30 41 44 50 51 52 54 55 57 70]
[3 5 13 17 18 23 24 28 31 38 42 43 45 48 50 53 57 66 68 69]
[1 2 6 9 10 11 14 27 28 34 35 41 44 45 46 52 55 56 64 65]
[4 5 8 13 16 18 22 33 34 36 39 42 43 44 50 51 55 60 69 70]
[7 8 12 13 16 27 31 32 39 41 46 47 48 55 56 61 63 64 66 70]
[1 9 12 20 23 24 26 28 33 36 45 50 52 55 57 60 62 63 64 65]
[4 5 8 9 10 13 18 19 25 30 33 34 37 47 51 54 58 66 67 68]
[2 3 8 10 11 13 14 21 31 36 40 42 46 49 55 56 57 62 65 69]
[1 7 9 18 22 25 31 36 38 39 41 42 44 53 54 56 60 61 64 65]
[1 3 8 11 13 14 16 17 20 22 31 34 35 41 42 43 60 64 68 69]
[3 4 5 8 12 14 23 24 27 28 31 37 39 44 49 55 59 66 69 70]
[7 13 16 21 22 25 28 29 32 35 37 38 39 42 46 47 48 55 57 62]
[2 5 10 11 12 14 16 18 22 24 26 27 30 36 40 41 52 57 62 64 5]
[4 8 9 10 13 17 23 24 29 32 34 39 42 43 56 57 59 64 67 68 3]
[2 7 11 15 22 24 25 35 37 38 39 40 41 45 52 57 62 67 68 69 3]
[9 11 18 20 21 25 33 34 41 42 45 49 50 52 53 55 56 63 66 69 2]
[1 2 11 12 13 15 22 26 27 35 36 37 39 40 57 60 65 68 69 70 2]
[3 7 11 12 13 14 17 20 24 29 31 34 38 39 41 46 59 62 67 69 2]
[4 9 17 21 22 23 29 32 36 41 43 44 45 47 54 55 57 67 69 70 2]
[1 3 5 7 13 19 21 22 23 24 32 33 38 45 47 49 52 53 60 66 2]
[6 8 11 14 15 16 24 25 30 34 35 36 51 58 61 62 65 68 69 70 5]
[2 3 4 6 7 9 18 23 24 25 26 38 42 43 46 49 50 57 69 70 2]
[1 2 9 11 13 16 20 21 22 25 26 27 29 31 38 47 48 63 67 70 2]]

Best Regards,
Jim

0 Kudos
0 Replies
Reply