{"id":21714125,"url":"https://github.com/arcxteam/allora-usa-election","last_synced_at":"2025-04-12T19:09:17.407Z","repository":{"id":258195595,"uuid":"868876439","full_name":"arcxteam/allora-usa-election","owner":"arcxteam","description":"Run a model predicting the USA presidential party winner 2024, Allora worker for topic 11 an initial inferences of token R : Republican and D : Democrat","archived":false,"fork":false,"pushed_at":"2024-12-22T17:12:30.000Z","size":199,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T19:09:07.124Z","etag":null,"topics":["ai","allora","allora-node","crypto-prediction","forecasting","polymarket","prediction-model","presidential-election","testnet-node","trained-models","usa-election-result"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arcxteam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-07T10:41:59.000Z","updated_at":"2025-01-12T18:26:18.000Z","dependencies_parsed_at":"2024-10-18T00:43:50.903Z","dependency_job_id":"538f3d48-7735-4fff-97ac-8aef7a805126","html_url":"https://github.com/arcxteam/allora-usa-election","commit_stats":null,"previous_names":["arcxteam/allora-usa-election"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcxteam%2Fallora-usa-election","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcxteam%2Fallora-usa-election/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcxteam%2Fallora-usa-election/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcxteam%2Fallora-usa-election/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arcxteam","download_url":"https://codeload.github.com/arcxteam/allora-usa-election/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618277,"owners_count":21134200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","allora","allora-node","crypto-prediction","forecasting","polymarket","prediction-model","presidential-election","testnet-node","trained-models","usa-election-result"],"created_at":"2024-11-26T00:31:52.674Z","updated_at":"2025-04-12T19:09:17.372Z","avatar_url":"https://github.com/arcxteam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![IMG_098555555555](https://github.com/user-attachments/assets/59d316cc-f006-4f44-841c-cc5b84ad088b)\n\n# Disclaimer...Reading!!!\n**`This campaign rewards users who run worker nodes providing inferences for the US presidential election party winner once a day. Every inference should be the likelihood of the republican party winning the election. source`** [run-inference-political](https://app.allora.network/points/campaign/run-inference-political)\n\n## 1. Components\n- **Worker**: The node that publishes inferences to the Allora chain.\n- **Inference**: A container that conducts inferences, maintains the model state, and responds to internal inference requests via a Flask application. This node operates with a basic linear regression model for price predictions.\n- **Updater**: A cron-like container designed to update the inference node's data by daily fetching the latest market information from the data provider, ensuring the model stays current with new market trends.\n- **Topic ID**: Running this worker on `TopicId 11`\n- **TOKEN= D** For have inference `D`: Democrat\n- **TOKEN= R** For have inference `R`: Republic\n- **MODEL**: Own model or modify or check folder /models `model.py`\n- **Probability**: Predict of `%` total `0 - 100%`\n- **Dataset**: [polymarket.com](https://polymarket.com/elections)\n- **An expected result**: Every `24` hours \n\n### Setup Worker\nThe structure of topic 11 - Allora Worker Node\n\n```sh\n./root/allora-usa-election\n├── config.json\n├── docker-compose.yml\n├── Dockerfile\n├── app.py\n├── model.py\n├── requirements.txt\n├── worker-data\n       └── environment\n├── inference-data\n       └── dataset.csv (R/D)\n       └── model\n             └── model.pkl (R/D)\n```\n\n1. **Clone this repository**\n   ```sh\n   git clone https://github.com/arcxteam/allora-usa-election.git\n   cd allora-usa-election\n    ```\n2. **Provided and config environment file modify model-tunning**\n    \n    Copy and read the example .env.example for your variables\n    ```sh\n    nano .env.example .env\n    ```\n    Here are the currently accepted configuration\n   - TOKEN= (`D` or `R`)\n   - MODEL= the name as model (defaults `SVR` or modify your own model)\n   - Save `ctrl X + Y and Enter`\n   \n   Modify model-tunning or check /models folder\n   ```sh\n    nano model.py\n    ```\n\n4. **Edit your config \u0026 initialize worker**\n\n   Edit for key wallet - name wallet - RPC endpoint \u0026 interval etc\n    ```sh\n    nano config.json\n    ```\n   Run the following commands root directory to initialize the worker\n    ```sh\n    chmod +x init.config\n    ./init.config\n    ```\n5. **Start the Services**\n    \n    Run the following command to start the worker node, inference, and updater nodes:\n    ```sh\n    docker compose up --build -d\n    ```\n    Check running\n    ```sh\n    docker compose logs -f --tail=100\n    ```\n\n   To confirm that the worker successfully sends the inferences to the chain, look for the following logs:\n    ```\n    {\"level\":\"debug\",\"msg\":\"Send Worker Data to chain\",\"txHash\":\u003ctx-hash\u003e,\"time\":\u003ctimestamp\u003e,\"message\":\"Success\"}\n    ```\n\n   ![Capture333654](https://github.com/user-attachments/assets/a61b3779-e80e-4e8a-8518-672f55e30f06)\n\n## 2. Testing Inference Only\n\n   Send requests to the inference model. For example, request probability of Democrat(`D`) or Republic(`R`)\n   ```sh\n   curl http://127.0.0.1:8000/inference/D\n   ```\n   Expected response of numbering:\n   `\n   \"value\":\"xx.xxxx\"`\n\n## 3. Note: Checking the logs that worker are registered successfully\n   ```sh\n   docker logs -f (your container id) 2\u003e\u00261 | head -n 70\n   ```\n\n   ```sh\n   docker logs -f (your container id) 2\u003e\u00261 | grep -i \"Success\"\n   ```\n   **Result every 24H: This will only get 1 request per day for topic 11 and points will depends on how your worker prediction vs the ground truth from polymarket**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcxteam%2Fallora-usa-election","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcxteam%2Fallora-usa-election","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcxteam%2Fallora-usa-election/lists"}