pyeggp 1.0.0__cp39-cp39-manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyeggp/__init__.py +114 -0
- pyeggp/__main__.py +11 -0
- pyeggp/_binding.cpython-39-aarch64-linux-gnu.so +0 -0
- pyeggp/_binding.py +20 -0
- pyeggp/_binding.pyi +7 -0
- pyeggp/binding.i +64 -0
- pyeggp/typing.py +14 -0
- pyeggp-1.0.0.dist-info/METADATA +710 -0
- pyeggp-1.0.0.dist-info/RECORD +126 -0
- pyeggp-1.0.0.dist-info/WHEEL +5 -0
- pyeggp-1.0.0.dist-info/entry_points.txt +2 -0
- pyeggp-1.0.0.dist-info/licenses/LICENSE +674 -0
- pyeggp-1.0.0.dist-info/top_level.txt +1 -0
- pyeggp./libHSOneTuple-0-0fad6f95.4.2-0591f3e9d2ab2c564200539cf8445a7c6dcd681c093999111b68040154ff59a4-ghc9.12.1.so +0 -0
- pyeggp./libHSQuickCheck-2-853ff3ce.15.0.1-67048cf8b2df2dd9c80baee143e16d8bbe2f2bae67fbf5092b2b979a2801b332-ghc9.12.1.so +0 -0
- pyeggp./libHSStateVar-1-812d4049.2.2-64f75098b708d536d2ff7155f56be7a968baa4aa863b8f6d0484e3c8c2d6e157-ghc9.12.1.so +0 -0
- pyeggp./libHSadjunctions-4-08c510b8.4.3-200e4569428a7b9d72dc08fd354d8bd05e94b227faf30c5e4980b1fbf472f96a-ghc9.12.1.so +0 -0
- pyeggp./libHSaeson-2-0cf3a7dd.2.3.0-85899beee6074e3b1a99d1319eb30f1daea104c6122a4cc49a3919f03a266fd1-ghc9.12.1.so +0 -0
- pyeggp./libHSansi-terminal-1-073f726c.1.2-1ab6f2c5d49905c906f20f6a2589e46220c39261e6433a4bf596dae85ef8e79e-ghc9.12.1.so +0 -0
- pyeggp./libHSansi-terminal-types-1-a8ea4c01.1-a440c6d512c13472941addfbdeb975d2d781f1c3bf3ed7940778e0745df9e507-ghc9.12.1.so +0 -0
- pyeggp./libHSarray-0-fccb4906.5.8.0-5c7b-ghc9.12.1.so +0 -0
- pyeggp./libHSassoc-1-d5f7ac48.1.1-6b26d31f042bc86a8caee5816caa2d46fb226f262a82cef6c8a3b553c112b4f6-ghc9.12.1.so +0 -0
- pyeggp./libHSasync-2-70e80286.2.5-c92e5ad459b8cf2332634d258f80b2b4c8de1aa53e4e14d95b76dfb106067d80-ghc9.12.1.so +0 -0
- pyeggp./libHSatomic-primops-0-8525d305.8.8-3f648638846980dded6294ecf69c0739b0df71d6e38545709d2f52e2b97345be-ghc9.12.1.so +0 -0
- pyeggp./libHSattoparsec-0-5a01823a.14.4-l-attoparsec-internal-0533d859f13bababee6e7f0a9c3abb1458a5f7aaa2596878f112c25fc6c1d510-ghc9.12.1.so +0 -0
- pyeggp./libHSattoparsec-0-ab32a250.14.4-0e52eaae4b281a084c83010ec8ee089085933076c174cd4df8d9d0f0e71b96a8-ghc9.12.1.so +0 -0
- pyeggp./libHSattoparsec-expr-0-d760212e.1.1.2-7d9e8ad0239088b617c9beeb68c104c33a7fad953db53dbed3d04102e3579c1b-ghc9.12.1.so +0 -0
- pyeggp./libHSbase-4-5f4ebc53.21.0.0-6858-ghc9.12.1.so +0 -0
- pyeggp./libHSbase-orphans-0-a4b7b6b9.9.3-526a43bf866d24c5dc2019224ae7717df0cd3001f358448053fd277f42ec049a-ghc9.12.1.so +0 -0
- pyeggp./libHSbifunctors-5-dd99a80f.6.2-5adcb90113e068f05fea9cd137dab76f6a57b17b4add8deeb3eea25d2a00f1ce-ghc9.12.1.so +0 -0
- pyeggp./libHSbinary-0-e0885143.8.9.3-5cea3bb927265d502c3c05da62e8bbdbebdd875d1d5613c21ed27bf2663d08c5-ghc9.12.1.so +0 -0
- pyeggp./libHSbitvec-1-e2a8e0f9.1.5.0-58aea85251e4672daa32354829d545b4c21be8249b1fe9227eddc8dfe07b4c2a-ghc9.12.1.so +0 -0
- pyeggp./libHSbytestring-0-3eb07e66.12.2.0-2ff0-ghc9.12.1.so +0 -0
- pyeggp./libHScall-stack-0-3fd34cbe.4.0-d6de6ac68f11ab8620c6cdd9f8c062044da5466cb2a4ec90dffb487ab77f073a-ghc9.12.1.so +0 -0
- pyeggp./libHScharacter-ps-0-b6c1482c.1-9656883ecb76f01d1591c0349f434594c84d21179c351172bf11debc30236b0a-ghc9.12.1.so +0 -0
- pyeggp./libHScolour-2-a34a36fa.3.6-322e34617ac962072531798c92a9d2dde45c0375afcecd6d301a398ca78b227e-ghc9.12.1.so +0 -0
- pyeggp./libHScomonad-5-4b05d505.0.9-9fe78ce81d6364b00ad783edc43edaa03aef77f8c841988f570bea6962a969dd-ghc9.12.1.so +0 -0
- pyeggp./libHScontainers-0-25045be4.6.8-848496b616a3224ebde64112777a6f8844a245f0f18c0ea32553ce211983e8fe-ghc9.12.1.so +0 -0
- pyeggp./libHScontravariant-1-d9a67501.5.5-71dfb7ad037d5524cd1957df6d43471ac0b722658729b7511c5102ea93d647bc-ghc9.12.1.so +0 -0
- pyeggp./libHSdata-default-0-50cc1bfa.8.0.1-fb58a41faf85adc3f0302d45b70bb2e1c895f2795a77b3984a009dc7de975bcf-ghc9.12.1.so +0 -0
- pyeggp./libHSdata-default-class-0-7cde4708.2.0.0-2e7610f43c0b94a0bf42c2ad925d2380e47f7eeeacfec4a603edfef153744301-ghc9.12.1.so +0 -0
- pyeggp./libHSdata-fix-0-f170a054.3.4-2bfba7fd0d8f9afd61a130d24fa446efb743dd3aa85043c1c81a7dfe509c758c-ghc9.12.1.so +0 -0
- pyeggp./libHSdeepseq-1-62522f6d.5.1.0-75ab-ghc9.12.1.so +0 -0
- pyeggp./libHSdense-linear-algebra-0-a96589da.1.0.0-5f52c331731c92d26ade7c268ae694750dfebe16fc843035b745cfd85d5e5573-ghc9.12.1.so +0 -0
- pyeggp./libHSdirectory-1-758d51e7.3.9.0-557d-ghc9.12.1.so +0 -0
- pyeggp./libHSdistributive-0-140d9000.6.2.1-d8f91e633b26510aae2f6c6caf4749213c264a83679ee5b63446ba2b4156813f-ghc9.12.1.so +0 -0
- pyeggp./libHSdlist-1-943b863e.0-7019d20b35502b80db5bd932183a7750bae22b99ab180f2c5821b29913713ecf-ghc9.12.1.so +0 -0
- pyeggp./libHSexceptions-0-c2e0ee36.10.9-90a0-ghc9.12.1.so +0 -0
- pyeggp./libHSfile-io-0-4316b257.1.5-b866-ghc9.12.1.so +0 -0
- pyeggp./libHSfilepath-1-4350fb89.5.4.0-c11a-ghc9.12.1.so +0 -0
- pyeggp./libHSfree-5-3cebb1de.2-95da4d4470da2dc977a781372f7334eed4f53597a53d302b443802917647acdd-ghc9.12.1.so +0 -0
- pyeggp./libHSgenerically-0-8c1f4c3b.1.1-57d2af2481156967e8b9eca67078b19e7ce59cb617197a9863a1ab65f86ac50f-ghc9.12.1.so +0 -0
- pyeggp./libHSghc-bignum-1-f60b3479.3-8645-ghc9.12.1.so +0 -0
- pyeggp./libHSghc-boot-th-9-5d7c4d94.12.1-5624-ghc9.12.1.so +0 -0
- pyeggp./libHSghc-internal-9-bf5d1861.1201.0-77bb-ghc9.12.1.so +0 -0
- pyeggp./libHSghc-prim-0-293fc076.13.0-f746-ghc9.12.1.so +0 -0
- pyeggp./libHShashable-1-0a0a4995.5.0.0-5e145d8090e5f73b37032b6cbdbab743e07bcd1ab78721b0ffb52ebbd351bb6f-ghc9.12.1.so +0 -0
- pyeggp./libHSieee754-0-d96f96ff.8.0-3787d51188ccd3e6429c390f288d8f6a2d3ce9b8e1d97bd2b48e7f85386b8846-ghc9.12.1.so +0 -0
- pyeggp./libHSindexed-traversable-0-c838d734.1.4-4c572910c2f9b0a838d91a4b9ac14ad883f2f162ff31ee0370d9b703bda796af-ghc9.12.1.so +0 -0
- pyeggp./libHSindexed-traversable-instances-0-98b001c4.1.2-484b2035cd1d67a44d13e6032edb0e25a9f5503879280854338de39ea123b086-ghc9.12.1.so +0 -0
- pyeggp./libHSinteger-conversion-0-d38fd894.1.1-7067868281e19e2e2c7f2f4ec643f0720f9efb37db274b15e347343cec3208ad-ghc9.12.1.so +0 -0
- pyeggp./libHSinteger-logarithms-1-2af75c92.0.4-45f162ea756d78ffd93584469e131f09b475e19cf258e3d041d17350207cb22e-ghc9.12.1.so +0 -0
- pyeggp./libHSinvariant-0-490492fa.6.4-c5982f38a5e29b219b937a7bf9924a3fd09029e8c20de896dcbf673b253ab331-ghc9.12.1.so +0 -0
- pyeggp./libHSkan-extensions-5-448f535e.2.6-ed611b9a65610af960cbf6f25655d0eb897ef86e953fbb7265ea883638b32e2d-ghc9.12.1.so +0 -0
- pyeggp./libHSlens-5-ed136a18.3.4-a59d1bdec27ad9492199783a4c521d3cdb9d1fb3638245e9138440ac0048fb63-ghc9.12.1.so +0 -0
- pyeggp./libHSlist-shuffle-1-4946ed56.0.0.1-0327069e49aabedb440fc0453e273df9b89c69f5f1f0a1b14a724aa963f17732-ghc9.12.1.so +0 -0
- pyeggp./libHSmassiv-1-5bbc5f12.0.4.1-b9ad31c33975a00255d66ed8c12e0349496c1ebe511876538d88d5c3c577cefc-ghc9.12.1.so +0 -0
- pyeggp./libHSmath-functions-0-ea0a69d2.3.4.4-cfeae00c4fb031f009deb5df63f48390e19d290b3d84a5c58ca864775824a357-ghc9.12.1.so +0 -0
- pyeggp./libHSmtl-2-ea282ad6.3.1-ac54-ghc9.12.1.so +0 -0
- pyeggp./libHSmwc-random-0-b8bdf9e4.15.2.0-42bfbe2f72a8519cd98631a62b56c7a7b84b42d419577036880aa38ce0522046-ghc9.12.1.so +0 -0
- pyeggp./libHSnetwork-uri-2-c4381022.6.4.2-eb3f50af18ff9e46c81a43b96fa3be439a45cafa5d9eb6445688288760fb5a10-ghc9.12.1.so +0 -0
- pyeggp./libHSoptparse-applicative-0-16f481b9.18.1.0-402ba4181f4913ae56ae118ae58c9e188168b001234b651fb6b4ecfb62c0ccca-ghc9.12.1.so +0 -0
- pyeggp./libHSos-string-2-27b96eca.0.7-73c2-ghc9.12.1.so +0 -0
- pyeggp./libHSparallel-3-9160a6db.2.2.0-e935161f9df63efd32613526a0cbd0ede857b40a07c8edb6060c9fe5c0f5211e-ghc9.12.1.so +0 -0
- pyeggp./libHSparsec-3-6c21c9f8.1.18.0-cd799c3141f803a60da9d71e237ba4a67d67b75a9b0f381378fe9278227b49c2-ghc9.12.1.so +0 -0
- pyeggp./libHSpretty-1-8460cdd8.1.3.6-b5e6-ghc9.12.1.so +0 -0
- pyeggp./libHSprettyprinter-1-c75a85d9.7.1-e61c285b0d0fc9b314b0e5e80033daffd7179c0552d3e80ffe6fa8dc643411ad-ghc9.12.1.so +0 -0
- pyeggp./libHSprettyprinter-ansi-terminal-1-c4a20e56.1.3-6eb57edd61914a6072da30f130dad7292e370890cc6ed64304a0b30b1a76d4c0-ghc9.12.1.so +0 -0
- pyeggp./libHSprimitive-0-c8515277.9.1.0-471d53302a8128fd928bde012361f3e7574f62145ba5802eda71b781b7d60592-ghc9.12.1.so +0 -0
- pyeggp./libHSprocess-1-a360a377.6.25.0-666f-ghc9.12.1.so +0 -0
- pyeggp./libHSprofunctors-5-8e00b145.6.2-8a149d362db3ea4fe95489447de720b5763d48f88e6d310380b5ce10bdf76ce7-ghc9.12.1.so +0 -0
- pyeggp./libHSpvar-1-50f63c8b.0.0.0-703e618dce5e3f15adbfb700f425d6a3ea9f8f71b9cf4836b42b990266bac1fd-ghc9.12.1.so +0 -0
- pyeggp./libHSrandom-1-d2d045ac.3.1-488d7587872267f3836f004841fae7038445a72bd0552d842851c4300c4e0761-ghc9.12.1.so +0 -0
- pyeggp./libHSreflection-2-dd6522e4.1.9-01bf5f35a171182da96bf12429651143f5d1d70a0dbedc425d187290fd7d53a0-ghc9.12.1.so +0 -0
- pyeggp./libHSrts-1-76025355.0.2-ghc9.12.1.so +0 -0
- pyeggp./libHSsafe-exceptions-0-b1aab45d.1.7.4-bbdf3f66454f8aa86dfb67638eccb8dadf371ecee15a965408a0e729eb29a990-ghc9.12.1.so +0 -0
- pyeggp./libHSscheduler-2-7dfed772.0.1.0-517d7ffb079dc7309b80b6749b41491a457c3dbb09eab113e55469dd8dd423d1-ghc9.12.1.so +0 -0
- pyeggp./libHSscientific-0-47421c12.3.8.0-8562d62e72fec308401328558109fb633b317fac49bcbefaee9d26f6edd58794-ghc9.12.1.so +0 -0
- pyeggp./libHSsemialign-1-30a90386.3.1-737aaf4f52ad7097a082410f385fd254402a05a7cfdeb6e3124d202260fb6d8e-ghc9.12.1.so +0 -0
- pyeggp./libHSsemigroupoids-6-717285c4.0.1-3ad6c556d8762127b1de1feca6bcc41debd210cdc082b61b105565e978dfe7c1-ghc9.12.1.so +0 -0
- pyeggp./libHSsemigroups-0-7ecb7fef.20-f78d0a98c3707cdfa9731e19e06da64c131c6e10676dd5a3c3ae7142c6664f8d-ghc9.12.1.so +0 -0
- pyeggp./libHSsplit-0-46e28277.2.5-803354f04face7771c208b14aa3d31008660c9d04787944cccbe9cbb4cfac808-ghc9.12.1.so +0 -0
- pyeggp./libHSsplitmix-0-f14515e2.1.1-38b21dc90d30086dd045eef0c9b9e9e1b9e31420c3939f56db3a23e5f9bfcc46-ghc9.12.1.so +0 -0
- pyeggp./libHSsrtree-2-4f418792.0.1.2-8a89f2d89790a02d228d7fbdb7ab9deca8126ca1b030acaea4c8a45302f2af8d-ghc9.12.1.so +0 -0
- pyeggp./libHSstatistics-0-872ef141.16.3.0-4f8eaba12c4468175a6795ee594c8613da5ac0d7202049905ebffa55519a4235-ghc9.12.1.so +0 -0
- pyeggp./libHSstm-2-ce5370c1.5.3.1-9155-ghc9.12.1.so +0 -0
- pyeggp./libHSstrict-0-89ca0a3a.5.1-d46a3ad308f4926f1bb6c6836063450e9b7d58426311b5b1e4c4a55ce7d153a3-ghc9.12.1.so +0 -0
- pyeggp./libHStagged-0-dcce9174.8.9-120e69eb2ce49651a48bda383e1daef240f811534ec9b1e19f20143a1d0213a2-ghc9.12.1.so +0 -0
- pyeggp./libHStemplate-haskell-2-9720f5e2.23.0.0-1988-ghc9.12.1.so +0 -0
- pyeggp./libHStext-2-49760f74.1.2-510891a1a0b55a375474e0a3d91586fa85280e4296860d053d59c26ded088475-ghc9.12.1.so +0 -0
- pyeggp./libHStext-iso8601-0-3214417c.1.1-239aa5d4a669e279166addca3db002c31dc61f97f6384587b361377e82feafaf-ghc9.12.1.so +0 -0
- pyeggp./libHStext-short-0-1e3c82ef.1.6-875487745a7528d12167c87753d7064983febe6d8c4ff37e9a97ea885ff2e8fc-ghc9.12.1.so +0 -0
- pyeggp./libHSth-abstraction-0-3ad142cc.7.1.0-31f7a5ce7dd0158b933f86d35599d430c97519a6e26cf85284f83a128f2440e4-ghc9.12.1.so +0 -0
- pyeggp./libHSth-compat-0-d089b771.1.6-e5062773d7cdc36090f5e295af5a591abbfa94cc7ec03f46d6c37944e69b1c30-ghc9.12.1.so +0 -0
- pyeggp./libHSthese-1-c3ab8558.2.1-e5f9d1c6194e9981d6a9e09d6fbf5a8d53e42b148f8f104f17696d6476839d80-ghc9.12.1.so +0 -0
- pyeggp./libHStime-1-0ac400a3.14-e7d0-ghc9.12.1.so +0 -0
- pyeggp./libHStime-compat-1-840df22d.9.8-835488aed301b42ba9c1db7c65405a9ab7e0c48fb8d3211bd0cd08285ca6ff16-ghc9.12.1.so +0 -0
- pyeggp./libHStransformers-0-83311135.6.1.2-a51b-ghc9.12.1.so +0 -0
- pyeggp./libHStransformers-base-0-7c534e46.4.6-cea14f20490549ca3f94107c8f941d13edc1edc763dd9a0432e77a35ea850355-ghc9.12.1.so +0 -0
- pyeggp./libHStransformers-compat-0-14636322.7.2-40f8f3e82b0a7028ab51582a56fa11f90f137e803e986be38072e06d2354062e-ghc9.12.1.so +0 -0
- pyeggp./libHSunix-2-68ab2a96.8.6.0-cbf7-ghc9.12.1.so +0 -0
- pyeggp./libHSunliftio-0-7b3fee66.2.25.1-480a6f89e4427bb43652f6549386ab6a5bbb74ed91a1fd73bd98b96e401d1f76-ghc9.12.1.so +0 -0
- pyeggp./libHSunliftio-core-0-d50fdd8f.2.1.0-825bb6bf8dc39c523e6f369c90dcb8f3a807b75e50075892449a53bdc32f3f65-ghc9.12.1.so +0 -0
- pyeggp./libHSunordered-containers-0-81b27626.2.20-2297d7c91f2909e232b53d6f4ab877ffb3164415864876b4bb479e5925618ec5-ghc9.12.1.so +0 -0
- pyeggp./libHSuuid-types-1-cff95e4c.0.6-cd040be7ac4eb8ad2b1a15ee08db954968623d0bdcc19eca3494326556b17e86-ghc9.12.1.so +0 -0
- pyeggp./libHSvector-0-da71ffa5.13.2.0-801e68a3d7c930d81d8d0208304485de44588cb8669867eca9e8f9845b5f29c0-ghc9.12.1.so +0 -0
- pyeggp./libHSvector-algorithms-0-236350e2.9.1.0-4dfd868e0cdc4541199efb20cea720d6264958774e82cfd623739427f7dcb620-ghc9.12.1.so +0 -0
- pyeggp./libHSvector-binary-instances-0-4b37329e.2.5.2-95a4471fd43d54fc50c32a9309702f8ab3f1d782a9c16a3af2744600689dd1a4-ghc9.12.1.so +0 -0
- pyeggp./libHSvector-stream-0-07d40a02.1.0.1-0fd482c1b2f4bf984637a4d2b16202e08d37e1e35d6c5f49e6fff8cb125b247c-ghc9.12.1.so +0 -0
- pyeggp./libHSvector-th-unbox-0-801ceab8.2.2-8b3c85ee4a2614fd1d535cab23c6dfc473cd7726eece578a0565df67a3061f5f-ghc9.12.1.so +0 -0
- pyeggp./libHSvoid-0-c276c56e.7.3-aacb42d318f52ceb183dd84d35491ff7e4a60df69862511705d9c9b650bcc043-ghc9.12.1.so +0 -0
- pyeggp./libHSwitherable-0-7fa9bc90.5-6f09003953cbc9bb062b65125b930ff0711f329c1f049bcf9be2a55919917386-ghc9.12.1.so +0 -0
- pyeggp./libHSzlib-0-48ee1f9e.7.1.0-5585aebc199b08d8e21b5678c0fd28335affe6252f54678c4f1c6e826f94e976-ghc9.12.1.so +0 -0
- pyeggp./libffi-c0132414.so.8 +0 -0
- pyeggp./libgmp-6d1678ee.so.10.3.2 +0 -0
- pyeggp./libnlopt-38a103cb.so.0 +0 -0
pyeggp/__init__.py
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
import atexit
|
2
|
+
from contextlib import contextmanager
|
3
|
+
from threading import Lock
|
4
|
+
from typing import Iterator, List
|
5
|
+
from io import StringIO
|
6
|
+
import tempfile
|
7
|
+
import csv
|
8
|
+
|
9
|
+
import numpy as np
|
10
|
+
import pandas as pd
|
11
|
+
from sklearn.base import BaseEstimator, RegressorMixin
|
12
|
+
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
|
13
|
+
from sklearn.metrics import mean_squared_error, r2_score
|
14
|
+
|
15
|
+
from ._binding import (
|
16
|
+
unsafe_hs_pyeggp_version,
|
17
|
+
unsafe_hs_pyeggp_main,
|
18
|
+
unsafe_hs_pyeggp_run,
|
19
|
+
unsafe_hs_pyeggp_init,
|
20
|
+
unsafe_hs_pyeggp_exit,
|
21
|
+
)
|
22
|
+
|
23
|
+
VERSION: str = "1.3.0"
|
24
|
+
|
25
|
+
|
26
|
+
_hs_rts_init: bool = False
|
27
|
+
_hs_rts_lock: Lock = Lock()
|
28
|
+
|
29
|
+
|
30
|
+
def hs_rts_exit() -> None:
|
31
|
+
global _hs_rts_lock
|
32
|
+
with _hs_rts_lock:
|
33
|
+
unsafe_hs_pyeggp_exit()
|
34
|
+
|
35
|
+
|
36
|
+
@contextmanager
|
37
|
+
def hs_rts_init(args: List[str] = []) -> Iterator[None]:
|
38
|
+
global _hs_rts_init
|
39
|
+
global _hs_rts_lock
|
40
|
+
with _hs_rts_lock:
|
41
|
+
if not _hs_rts_init:
|
42
|
+
_hs_rts_init = True
|
43
|
+
unsafe_hs_pyeggp_init(args)
|
44
|
+
atexit.register(hs_rts_exit)
|
45
|
+
yield None
|
46
|
+
|
47
|
+
|
48
|
+
def version() -> str:
|
49
|
+
with hs_rts_init():
|
50
|
+
return unsafe_hs_pyeggp_version()
|
51
|
+
|
52
|
+
|
53
|
+
def main(args: List[str] = []) -> int:
|
54
|
+
with hs_rts_init(args):
|
55
|
+
return unsafe_hs_pyeggp_main()
|
56
|
+
|
57
|
+
def pyeggp_run(dataset: str, gen: int, nPop: int, maxSize: int, nTournament: int, pc: float, pm: float, nonterminals: str, loss: str, optIter: int, optRepeat: int, nParams: int, split: int, simplify: int, dumpTo: str, loadFrom: str) -> str:
|
58
|
+
with hs_rts_init():
|
59
|
+
return unsafe_hs_pyeggp_run(dataset, gen, nPop, maxSize, nTournament, pc, pm, nonterminals, loss, optIter, optRepeat, nParams, split, simplify, dumpTo, loadFrom)
|
60
|
+
|
61
|
+
class PyEGGP(BaseEstimator, RegressorMixin):
|
62
|
+
def __init__(self, gen = 100, nPop = 100, maxSize = 15, nTournament = 3, pc = 0.9, pm = 0.3, nonterminals = "add,sub,mul,div", loss = "MSE", optIter = 50, optRepeat = 2, nParams = -1, split = 1, simplify = False, dumpTo = "", loadFrom = ""):
|
63
|
+
self.gen = gen
|
64
|
+
self.nPop = nPop
|
65
|
+
self.maxSize = maxSize
|
66
|
+
self.nTournament = nTournament
|
67
|
+
self.pc = pc
|
68
|
+
self.pm = pm
|
69
|
+
self.nonterminals = nonterminals
|
70
|
+
self.loss = loss
|
71
|
+
self.optIter = optIter
|
72
|
+
self.optRepeat = optRepeat
|
73
|
+
self.nParams = nParams
|
74
|
+
self.split = split
|
75
|
+
self.simplify = int(simplify)
|
76
|
+
self.dumpTo = dumpTo
|
77
|
+
self.loadFrom = loadFrom
|
78
|
+
self.is_fitted_ = False
|
79
|
+
|
80
|
+
def fit(self, X, y):
|
81
|
+
if X.ndim == 1:
|
82
|
+
X = X.reshape(-1,1)
|
83
|
+
y = y.reshape(-1, 1)
|
84
|
+
combined = np.hstack([X, y])
|
85
|
+
header = [f"x{i}" for i in range(X.shape[1])] + ["y"]
|
86
|
+
with tempfile.NamedTemporaryFile(mode='w+', newline='', delete=False, suffix='.csv') as temp_file:
|
87
|
+
writer = csv.writer(temp_file)
|
88
|
+
writer.writerow(header)
|
89
|
+
writer.writerows(combined)
|
90
|
+
dataset = temp_file.name
|
91
|
+
|
92
|
+
csv_data = pyeggp_run(dataset, self.gen, self.nPop, self.maxSize, self.nTournament, self.pc, self.pm, self.nonterminals, self.loss, self.optIter, self.optRepeat, self.nParams, self.split, self.simplify, self.dumpTo, self.loadFrom)
|
93
|
+
if len(csv_data) > 0:
|
94
|
+
csv_io = StringIO(csv_data.strip())
|
95
|
+
self.results = pd.read_csv(csv_io, header=0)
|
96
|
+
self.is_fitted_ = True
|
97
|
+
return self
|
98
|
+
|
99
|
+
def predict(self, X):
|
100
|
+
check_is_fitted(self)
|
101
|
+
return self.evaluate_best_model(self.model_, X)
|
102
|
+
def evaluate_best_model(self, x):
|
103
|
+
if x.ndim == 1:
|
104
|
+
x = x.reshape(-1,1)
|
105
|
+
t = np.array(list(map(float, self.results.iloc[-1].theta.split(";"))))
|
106
|
+
return eval(self.results.iloc[-1].Numpy)
|
107
|
+
def evaluate_model(self, ix, x):
|
108
|
+
if x.ndim == 1:
|
109
|
+
x = x.reshape(-1,1)
|
110
|
+
t = np.array(list(map(float, self.results.iloc[-1].theta.split(";"))))
|
111
|
+
return eval(self.results.iloc[i].Numpy)
|
112
|
+
def score(self, X, y):
|
113
|
+
ypred = self.evaluate_best_model(X)
|
114
|
+
return r2_score(y, ypred)
|
pyeggp/__main__.py
ADDED
Binary file
|
pyeggp/_binding.py
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
def __bootstrap__():
|
2
|
+
global __bootstrap__, __file__, __loader__
|
3
|
+
import sys, os, pkg_resources, importlib.util
|
4
|
+
__file__ = pkg_resources.resource_filename(__name__,'_binding.cpython-39-aarch64-linux-gnu.so')
|
5
|
+
del __bootstrap__
|
6
|
+
if '__loader__' in globals():
|
7
|
+
del __loader__
|
8
|
+
|
9
|
+
old_dir = os.getcwd()
|
10
|
+
try:
|
11
|
+
os.chdir(os.path.dirname(__file__))
|
12
|
+
|
13
|
+
spec = importlib.util.spec_from_file_location(
|
14
|
+
__name__, __file__)
|
15
|
+
mod = importlib.util.module_from_spec(spec)
|
16
|
+
spec.loader.exec_module(mod)
|
17
|
+
finally:
|
18
|
+
|
19
|
+
os.chdir(old_dir)
|
20
|
+
__bootstrap__()
|
pyeggp/_binding.pyi
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
def unsafe_hs_pyeggp_version() -> str: ...
|
4
|
+
def unsafe_hs_pyeggp_main() -> int: ...
|
5
|
+
def unsafe_hs_pyeggp_run(dataset: str, gen: int, nPop: int, maxSize: int, nTournament: int, pc: float, pm: float, nonterminals: str, loss: str, optIter: int, optRepeat: int, nParams: int, split: int, simplify: int, dumpTo: str, loadFrom: str) -> str: ...
|
6
|
+
def unsafe_hs_pyeggp_init(args: List[str]) -> None: ...
|
7
|
+
def unsafe_hs_pyeggp_exit() -> None: ...
|
pyeggp/binding.i
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
%module binding
|
2
|
+
%{
|
3
|
+
#include "Pyeggp_stub.h"
|
4
|
+
|
5
|
+
char * unsafe_hs_pyeggp_version() {
|
6
|
+
return hs_pyeggp_version();
|
7
|
+
}
|
8
|
+
|
9
|
+
int unsafe_hs_pyeggp_main() {
|
10
|
+
return hs_pyeggp_main();
|
11
|
+
}
|
12
|
+
|
13
|
+
char * unsafe_hs_pyeggp_run( char *dataset, int gens, int nPop, int maxSize, int nTournament, double pc, double pm, char *nonterminals, char *loss, int optIter, int optRepeat, int nParams, int split, int simplify, char *dumpTo, char *loadFrom ) {
|
14
|
+
return hs_pyeggp_run(dataset, gens, nPop, maxSize, nTournament, pc, pm, nonterminals, loss, optIter, optRepeat, nParams, split, simplify, dumpTo, loadFrom);
|
15
|
+
}
|
16
|
+
|
17
|
+
void unsafe_hs_pyeggp_init(int argc, char **argv) {
|
18
|
+
hs_init(&argc, &argv);
|
19
|
+
}
|
20
|
+
|
21
|
+
void unsafe_hs_pyeggp_exit() {
|
22
|
+
hs_exit();
|
23
|
+
}
|
24
|
+
|
25
|
+
void unsafe_py_write_stdout( char * str) {
|
26
|
+
PySys_FormatStdout("%s", str);
|
27
|
+
}
|
28
|
+
|
29
|
+
void unsafe_py_write_stderr( char * str) {
|
30
|
+
PySys_FormatStderr("%s", str);
|
31
|
+
}
|
32
|
+
%}
|
33
|
+
|
34
|
+
%typemap(in) (int argc, char **argv) {
|
35
|
+
/* Check if is a list */
|
36
|
+
if (PyList_Check($input)) {
|
37
|
+
int i;
|
38
|
+
$1 = PyList_Size($input);
|
39
|
+
$2 = (char **) malloc(($1+1)*sizeof(char *));
|
40
|
+
for (i = 0; i < $1; i++) {
|
41
|
+
PyObject *o = PyList_GetItem($input, i);
|
42
|
+
if (PyUnicode_Check(o)) {
|
43
|
+
$2[i] = (char *) PyUnicode_AsUTF8AndSize(o, 0);
|
44
|
+
} else {
|
45
|
+
PyErr_SetString(PyExc_TypeError, "list must contain strings");
|
46
|
+
SWIG_fail;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
$2[i] = 0;
|
50
|
+
} else {
|
51
|
+
PyErr_SetString(PyExc_TypeError, "not a list");
|
52
|
+
SWIG_fail;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
%typemap(freearg) (int argc, char **argv) {
|
57
|
+
free((char *) $2);
|
58
|
+
}
|
59
|
+
|
60
|
+
char * unsafe_hs_pyeggp_version();
|
61
|
+
int unsafe_hs_pyeggp_main();
|
62
|
+
char * unsafe_hs_pyeggp_run( char *dataset, int gens, int nPop, int maxSize, int nTournament, double p, double pm, char *nonterminals, char *loss, int optIter, int optRepeat, int nParams, int split, int simplify, char *dumpTo, char *loadFrom);
|
63
|
+
void unsafe_hs_pyeggp_init(int argc, char **argv);
|
64
|
+
void unsafe_hs_pyeggp_exit();
|
pyeggp/typing.py
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
from typing import List
|
4
|
+
|
5
|
+
if sys.version_info < (3, 8):
|
6
|
+
from typing_extensions import Protocol
|
7
|
+
else:
|
8
|
+
from typing import Protocol
|
9
|
+
|
10
|
+
|
11
|
+
class Session(Protocol):
|
12
|
+
def version(self) -> str: ...
|
13
|
+
def main(self, args: List[str] = []) -> int: ...
|
14
|
+
def pyeggp_run(self, dataset: str, gen: int, nPop: int, maxSize: int, nTournament: int, pc: float, pm: float, nonterminals: str, loss: str, optIter: int, optRepeat: int, nParams: int, split: int, simplify: int, dumpTo: str, loadFrom: str) -> str: ...
|