• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python syncpr.syncpr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyclustering.nnet.syncpr.syncpr函数的典型用法代码示例。如果您正苦于以下问题:Python syncpr函数的具体用法?Python syncpr怎么用?Python syncpr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了syncpr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: templateOutputDynamicLengthStaticSimulation

 def templateOutputDynamicLengthStaticSimulation(collect_flag, ccore_flag):
     net = syncpr(5, 0.1, 0.1, ccore_flag);
     output_dynamic = net.simulate_static(10, 10, [-1, 1, -1, 1, -1], solution = solve_type.FAST, collect_dynamic = collect_flag);
      
     if (collect_flag is True):
         assert len(output_dynamic) == 11; # 10 steps without initial values.
     else:
         assert len(output_dynamic) == 1;
开发者ID:annoviko,项目名称:pyclustering,代码行数:8,代码来源:syncpr_templates.py


示例2: templateOutputDynamicLengthDynamicSimulation

 def templateOutputDynamicLengthDynamicSimulation(collect_flag, ccore_flag):
     net = syncpr(5, 0.1, 0.1, ccore_flag);
     output_dynamic = net.simulate_dynamic([-1, 1, -1, 1, -1], solution = solve_type.FAST, collect_dynamic = collect_flag);
      
     if (collect_flag is True):
         assert len(output_dynamic) > 1;
     else:
         assert len(output_dynamic) == 1;
开发者ID:annoviko,项目名称:pyclustering,代码行数:8,代码来源:syncpr_templates.py


示例3: templateStaticSimulation

 def templateStaticSimulation(ccore_falg):
     net = syncpr(10, 0.1, 0.1, ccore_falg);
      
     patterns =  [];
     patterns += [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1] ];
     patterns += [ [-1, -1, -1, -1, -1, 1, 1, 1, 1, 1] ];
      
     net.train(patterns);
     net.simulate_static(20, 10, patterns[0], solve_type.RK4);
     memory_order = net.memory_order(patterns[0]);
      
     assert (memory_order > 0.95) and (memory_order <= 1.000005);
开发者ID:annoviko,项目名称:pyclustering,代码行数:12,代码来源:syncpr_templates.py


示例4: templateDynamicSimulation

 def templateDynamicSimulation(ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
      
     patterns =  [];
     patterns += [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1] ];
     patterns += [ [-1, -1, -1, -1, -1, 1, 1, 1, 1, 1] ];
      
     net.train(patterns);
     net.simulate_dynamic(patterns[0], order = 0.998, solution = solve_type.RK4);
     memory_order = net.memory_order(patterns[0]);
      
     assert (memory_order > 0.998) and (memory_order <= 1.0);
开发者ID:annoviko,项目名称:pyclustering,代码行数:12,代码来源:syncpr_templates.py


示例5: templateGlobalSyncOrder

 def templateGlobalSyncOrder(self, ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
     
     patterns =  [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1] ];
     patterns += [ [-1, -1, -1, -1, -1, 1, 1, 1, 1, 1] ];
     
     global_sync_order = net.sync_order();
     assert (global_sync_order < 1.0) and (global_sync_order > 0.0);
     
     net.train(patterns);
     
     global_sync_order = net.sync_order();
     assert (global_sync_order < 1.0) and (global_sync_order > 0.0);
开发者ID:abhishek792,项目名称:pyclustering,代码行数:13,代码来源:syncpr_tests.py


示例6: templateLocalSyncOrder

 def templateLocalSyncOrder(ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
     
     patterns =  [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1] ];
     patterns += [ [-1, -1, -1, -1, -1, 1, 1, 1, 1, 1] ];
     
     local_sync_order = net.sync_local_order();
     assert (local_sync_order < 1.0) and (local_sync_order > 0.0);
     
     net.train(patterns);
     
     local_sync_order = net.sync_local_order();
     assert (local_sync_order < 1.0) and (local_sync_order > 0.0);
开发者ID:annoviko,项目名称:pyclustering,代码行数:13,代码来源:syncpr_templates.py


示例7: templateMemoryOrder

 def templateMemoryOrder(ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
     
     patterns =  [];
     patterns += [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1] ];
     patterns += [ [-1, -1, -1, -1, -1, 1, 1, 1, 1, 1] ];
     
     net.train(patterns);
     assert net.memory_order(patterns[0]) < 0.8;
     assert net.memory_order(patterns[1]) < 0.8;
     
     for pattern in patterns:
         net.simulate(20, 10, pattern, solve_type.RK4);
         memory_order = net.memory_order(pattern);
         assert (memory_order > 0.95) and (memory_order <= 1.000005);
开发者ID:annoviko,项目名称:pyclustering,代码行数:15,代码来源:syncpr_templates.py


示例8: template_recognition_image

def template_recognition_image(images, steps, time, corruption = 0.1):
    samples = [];
    
    for file_name in images:
        data = read_image(file_name);
                
        image_pattern = rgb2gray(data);
                
        for index_pixel in range(len(image_pattern)):
            if (image_pattern[index_pixel] < 128):
                image_pattern[index_pixel] = 1;
            else:
                image_pattern[index_pixel] = -1;
                
        samples += [ image_pattern ];
    
    net = syncpr(len(samples[0]), 0.3, 0.3, ccore = True);
    net.train(samples);
    
    # Recognize the each learned pattern
    for i in range(len(samples)):
        sync_output_dynamic = net.simulate(steps, time, samples[i], solve_type.RK4, True);
        syncpr_visualizer.show_output_dynamic(sync_output_dynamic);
        syncpr_visualizer.show_pattern(sync_output_dynamic, 10, 10);
        
        # corrupt a little bit by black and white pixels
        for _ in range( math.floor(len(samples[i]) * corruption) ):
            random.seed();
            random_pixel = math.floor(random.random() * len(samples[i]));
            samples[i][random_pixel] = 1;
            
            random_pixel = math.floor(random.random() * len(samples[i]));
            samples[i][random_pixel] = -1;
        
        sync_output_dynamic = net.simulate(steps, time, samples[i], solve_type.RK4, True);
        syncpr_visualizer.show_output_dynamic(sync_output_dynamic);
        syncpr_visualizer.show_pattern(sync_output_dynamic, 10, 10);

        syncpr_visualizer.animate_pattern_recognition(sync_output_dynamic, 10, 10, title = "Pattern Recognition");
开发者ID:annoviko,项目名称:pyclustering,代码行数:39,代码来源:syncpr_examples.py


示例9: templateTrainNetworkAndRecognizePattern

 def templateTrainNetworkAndRecognizePattern(ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
      
     patterns =  [];
     patterns += [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1] ];
     patterns += [ [-1, -1, -1, -1, -1, 1, 1, 1, 1, 1] ];
      
     net.train(patterns);
      
     # recognize it
     for i in range(len(patterns)):
         output_dynamic = net.simulate(10, 10, patterns[i], solve_type.RK4, True);
          
         ensembles = output_dynamic.allocate_sync_ensembles(0.5);
         assert len(ensembles) == 2;
         assert len(ensembles[0]) == len(ensembles[1]);
          
         # sort results
         ensembles[0].sort();
         ensembles[1].sort();
          
         assert (ensembles[0] == [0, 1, 2, 3, 4]) or (ensembles[0] == [5, 6, 7, 8, 9]);
         assert (ensembles[1] == [0, 1, 2, 3, 4]) or (ensembles[1] == [5, 6, 7, 8, 9]);
开发者ID:annoviko,项目名称:pyclustering,代码行数:23,代码来源:syncpr_templates.py


示例10: templateIncorrectPatternForSimulation

 def templateIncorrectPatternForSimulation(self, pattern):
     net = syncpr(10, 0.1, 0.1);
      
     self.assertRaises(Exception, net.simulate, 10, 10, pattern);
开发者ID:abhishek792,项目名称:pyclustering,代码行数:4,代码来源:syncpr_tests.py


示例11: templateIncorrectPatternForTraining

 def templateIncorrectPatternForTraining(patterns, ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
     try: net.train(patterns);
     except: return;
     assert False;
开发者ID:annoviko,项目名称:pyclustering,代码行数:5,代码来源:syncpr_templates.py


示例12: templatePatternVisualizer

 def templatePatternVisualizer(self, collect_dynamic):
     net = syncpr(5, 0.1, 0.1);
     output_dynamic = net.simulate(10, 10, [-1, 1, -1, 1, -1], solve_type.RK4, collect_dynamic);
      
     # test that we don't have any exception during vizualization.
     syncpr_visualizer.show_pattern(output_dynamic, 5, 2);
开发者ID:abhishek792,项目名称:pyclustering,代码行数:6,代码来源:syncpr_tests.py


示例13: templateOutputDynamic

 def templateOutputDynamic(solver, ccore):
     net = syncpr(5, 0.1, 0.1, ccore);
     output_dynamic = net.simulate(10, 10, [-1, 1, -1, 1, -1], solver, True);
      
     assert len(output_dynamic) == 11; # 10 steps without initial values.
开发者ID:annoviko,项目名称:pyclustering,代码行数:5,代码来源:syncpr_templates.py


示例14: testCreateTenOscillatorsNetwork

 def testCreateTenOscillatorsNetwork(self):
     net = syncpr(10, 0.1, 0.1);
     assert len(net) == 10;
开发者ID:abhishek792,项目名称:pyclustering,代码行数:3,代码来源:syncpr_tests.py


示例15: testOutputDinamicLengthSimulation

 def testOutputDinamicLengthSimulation(self):
     net = syncpr(5, 0.1, 0.1);
     output_dynamic = net.simulate(10, 10, [-1, 1, -1, 1, -1], solution = solve_type.FAST, collect_dynamic = True);
      
     assert len(output_dynamic) == 11; # 10 steps without initial values.
开发者ID:abhishek792,项目名称:pyclustering,代码行数:5,代码来源:syncpr_tests.py


示例16: testCreateHundredOscillatorsNetworkByCore

 def testCreateHundredOscillatorsNetworkByCore(self):
     net = syncpr(100, 0.1, 0.1, True);
     assert len(net) == 100;
开发者ID:annoviko,项目名称:pyclustering,代码行数:3,代码来源:it_syncpr.py


示例17: templateIncorrectPatternForTraining

 def templateIncorrectPatternForTraining(self, patterns, ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore_flag);
      
     self.assertRaises(Exception, net.train, patterns);        
开发者ID:abhishek792,项目名称:pyclustering,代码行数:4,代码来源:syncpr_tests.py


示例18: templateIncorrectPatternForSimulation

 def templateIncorrectPatternForSimulation(pattern, ccore_flag):
     net = syncpr(10, 0.1, 0.1, ccore=ccore_flag);
     try: net.simulate(10, 10, pattern);
     except: return;
     assert False;
开发者ID:annoviko,项目名称:pyclustering,代码行数:5,代码来源:syncpr_templates.py


示例19: templatePatternVisualizer

 def templatePatternVisualizer(collect_dynamic, ccore_flag = False):
     net = syncpr(5, 0.1, 0.1, ccore = ccore_flag);
     output_dynamic = net.simulate(10, 10, [-1, 1, -1, 1, -1], solve_type.RK4, collect_dynamic);
      
     syncpr_visualizer.show_pattern(output_dynamic, 5, 2);
     syncpr_visualizer.animate_pattern_recognition(output_dynamic, 1, 5);
开发者ID:annoviko,项目名称:pyclustering,代码行数:6,代码来源:syncpr_templates.py


示例20: testCreateHundredOscillatorsNetwork

 def testCreateHundredOscillatorsNetwork(self):
     net = syncpr(100, 0.1, 0.1, ccore=False);
     assert len(net) == 100;
开发者ID:annoviko,项目名称:pyclustering,代码行数:3,代码来源:ut_syncpr.py



注:本文中的pyclustering.nnet.syncpr.syncpr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python som_templates.SomTestTemplates类代码示例发布时间:2022-05-25
下一篇:
Python sync.sync_network函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap