import random
import numpy as np
% matplotlib inline
import matplotlib. pyplot as plt
with open ( "testdata.txt" , 'w' ) as fw:
total = 50
x = [ ]
y = [ ]
for i in range ( 1 , total) :
a = random. uniform( - 4 , 4 )
b = random. uniform( 5 , 20 ) + a
x. append( a)
y. append( b)
fw. writelines( str ( a) + ' ' + str ( b) + ' ' + '0' + '\n' )
plt. scatter( x, y)
total = 50
x = [ ]
y = [ ]
for i in range ( 1 , total) :
a = random. uniform( - 4 , 4 )
b = random. uniform( - 10 , 10 ) + a
x. append( a)
y. append( b)
fw. writelines( str ( a) + ' ' + str ( b) + ' ' + '1' + '\n' )
plt. scatter( x, y)
testdata.txt
1.7239179761063106 11.621616738817881 0
1.3644791565183692 12.850056593500511 0
- 2.8241788227167 15.295105047052662 0
- 0.12096761924270982 15.874786442693807 0
- 1.1907304106668226 4.8230472771865545 0
3.88922203167406 10.481598295835838 0
- 1.5514013259782748 12.546587342124699 0
- 3.9080652903199526 14.863720814935565 0
2.8905823503919246 14.154052215869715 0
- 0.3713333039674973 5.85627941491275 0
- 3.650966596512319 12.358793724996886 0
1.8524828630704393 16.85384682123108 0
0.7815276199297516 19.928011423190423 0
1.1868119863064042 14.572097717559839 0
0.39290949856611235 9.439892257762391 0
- 0.4380052483257888 7.180656833515273 0
- 1.4205733552933255 15.330674281396096 0
- 2.6263493127221835 11.678565890789418 0
- 0.7507175361604244 18.156125737453877 0
- 2.892820682558207 8.79065046439107 0
3.5207117417590963 15.21773422345941 0
- 3.780217519644192 7.7737004746994804 0
1.4395838379857864 6.897627954129135 0
- 3.485964608262197 10.916386904249354 0
3.3246385675110313 14.333707156324603 0
1.1676140508544064 6.442484482045056 0
- 3.8481216395835807 15.75711938722526 0
1.1849484896656897 11.601755270469662 0
3.6312326582381784 18.119814114264802 0
- 2.009439020302379 11.545171821789669 0
0.27626114429143467 11.666729594397342 0
- 3.985993714143868 13.574048396767614 0
0.36319738221735776 10.126393870333015 0
2.364371813891035 18.669605141733847 0
- 1.8881430957099639 17.845978673009068 0
2.956793613716248 13.952227220980376 0
- 3.4684680188305084 10.254267125743652 0
0.7767252796982715 10.796194925340519 0
0.09665049611839116 5.181278906651645 0
1.490792701114417 8.344855481214633 0
- 0.7818084864690391 8.173744935577602 0
2.8979866043165563 20.959281355363185 0
1.9764448594536077 12.519030127592202 0
- 2.031361540068379 7.336767194880081 0
1.7946468492755514 15.551085708759762 0
- 0.5655463872715139 16.245272157091527 0
- 1.4181211304278145 15.566333360209892 0
- 2.276375126421028 15.8032454074095 0
- 2.9496483202378565 16.606673645732684 0
1.1558056913468784 - 0.07470307765165263 1
- 0.5128180350116036 - 1.864164003041763 1
1.7085205423884302 - 7.992611148265982 1
0.7371854204632671 6.223250194626885 1
1.865979496243379 11.56051031554393 1
- 0.8783262314523732 - 7.611468197007481 1
1.265644951917821 - 6.001017447687869 1
- 0.6584297875451117 - 0.04651328357152629 1
- 3.6337799169558007 5.063803558368734 1
0.3570538505285441 9.959044788799691 1
- 3.5558274632663487 - 10.498737552087386 1
- 0.2813420025495237 4.795824521302762 1
3.8332918461348227 6.361473003348151 1
1.8560631051352523 2.967595936514371 1
2.420461786648654 - 7.379660318665894 1
1.3470563270222788 3.4893913843326407 1
1.7278902882081404 5.80117720094238 1
3.9562502923673053 0.41207455773998536 1
- 1.6005011639455882 - 6.09309090290748 1
- 3.7098680010637555 - 10.99313922671572 1
1.3143883391615647 10.821468675108488 1
3.268736427069408 6.111495023735211 1
- 0.7565987892895816 1.3980691787362378 1
1.2591233366423547 - 0.9831497059334406 1
0.14359072155785935 3.494534030645144 1
- 3.8433462540908083 3.951941883121399 1
1.4697939686655603 - 5.599518604835492 1
- 3.780664866456174 - 3.4864309189615064 1
2.8036640330971343 6.7093178712957195 1
2.914060600848707 10.568181206795376 1
3.075690703667016 - 5.494070292666359 1
1.2476215555979637 - 1.227957248822607 1
- 3.6979408908614797 - 8.53864886006268 1
- 0.29778805466938074 - 1.0308480183611515 1
- 1.3700582053779717 7.586894812672029 1
- 0.4551627828857958 - 8.33802734849521 1
- 3.6398531372071696 - 12.32039811842116 1
- 3.9905250265961367 - 1.2746049190895494 1
- 1.9453103725425107 2.0946484479748344 1
0.2177808569353319 - 9.616021905809838 1
2.8356861932674287 6.041557788259138 1
1.8270389447333741 9.532644351097666 1
0.23792638793364063 - 9.580838569275198 1
1.8798408251944139 4.99921390596133 1
- 3.590369332673248 1.9426909313823053 1
0.6002997567953106 - 3.503420724970665 1
- 3.9556552193617147 - 11.364251432363737 1
3.2769517222906765 - 3.016506602206092 1
- 1.2469578613556882 - 6.306123291381851 1