{"id":21773155,"url":"https://github.com/YihongDong/FAN","last_synced_at":"2025-07-19T10:30:50.214Z","repository":{"id":258659863,"uuid":"867147298","full_name":"YihongDong/FAN","owner":"YihongDong","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-19T17:08:33.000Z","size":13400,"stargazers_count":96,"open_issues_count":2,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-19T17:28:46.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YihongDong.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-03T14:31:12.000Z","updated_at":"2024-11-19T17:08:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"44e28d78-24c3-4638-8af9-d3da0e431171","html_url":"https://github.com/YihongDong/FAN","commit_stats":null,"previous_names":["yihongdong/fan"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YihongDong%2FFAN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YihongDong%2FFAN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YihongDong%2FFAN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YihongDong%2FFAN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YihongDong","download_url":"https://codeload.github.com/YihongDong/FAN/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226584451,"owners_count":17655036,"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":[],"created_at":"2024-11-26T17:00:46.691Z","updated_at":"2025-07-19T10:30:50.183Z","avatar_url":"https://github.com/YihongDong.png","language":"Python","funding_links":[],"categories":["其他_机器学习与深度学习"],"sub_categories":[],"readme":"# FAN: Fourier Analysis Networks\n[![arXiv](https://img.shields.io/badge/arXiv-2410.02675-b31b1b.svg)](https://arxiv.org/abs/2410.02675)\n\n\u003cimg src=\"./img/FANLayer.jpg\" width=\"705\" alt=\"FAN Layer\"\u003e\n\n|                           | MLP Layer                                                |  FAN layer                                                                 |\n|---------------------------|:----------------------------------------------------------:|:------------------------------------------------------------------------:|\n| **Formula**                | $\\Phi(x) = \\sigma(B_{m} + W_{m}x)$                       | $\\phi(x) = [\\cos(W_px)\\|\\| \\sin(W_px)\\|\\| \\sigma(B_{\\bar{p}} + W_{\\bar{p}}x)]$       |\n| **Num of Params**          | $(d_\\text{input} \\times d_\\text{output}) + d_\\text{output}$ | $(1-\\frac{d_p}{d_\\text{output}})\\times((d_\\text{input} \\times d_\\text{output}) + d_\\text{output})$ |\n| **FLOPs**                  | $2\\times(d_\\text{input} \\times d_\\text{output})$\u003cbr\u003e $+ d_\\text{output} \\times \\text{FLOPs}_\\text{non-linear}$ | $(1-\\frac{d_p}{d_\\text{output}})\\times(2\\times(d_\\text{input} \\times d_\\text{output}))$ \u003cbr\u003e $+ d_\\text{output} \\times \\text{FLOPs}_\\text{non-linear} $ |\n\n\n## Periodicity Modeling\n```shell\ncd Periodicity_Modeling\nbash ./run.sh\n```\n![sin](./img/sin.jpg)\n![mod](./img/mod.jpg)\n\n## Scaling Law\nDetailed implementations are available in [![FANformer Repo](https://img.shields.io/badge/GitHub-FANformer-blue)](https://github.com/YihongDong/FANformer).\n\n## Sentiment Analysis\nThe data can be automatically downloaded using the Huggingface Datasets `load_dataset` function in the `./Sentiment_Analysis/get_dataloader.py`. \n\n```shell\ncd Sentiment_Analysis\nbash scripts/Trans_with_FAN/train_ours.sh\nbash scripts/Trans_with_FAN/test_ours.sh\n```\n\n## Timeseries Forecasting\nYou can obtain data from [Google Drive](https://drive.google.com/drive/folders/1v1uLx5zhGaNAOTIqHLHYMXtA-XFrKTxS?usp=sharing). All the datasets are well pre-processed and can be used easily.\n\n```shell\ncd Timeseries_Forecasting\nbash scripts/Weather_script/Modified_Transformer.sh \n```\n\n## Symbolic Formula Representation\n```shell\ncd Symbolic_Formula_Representation\npython gen_dataset.py\nbash run_train_fan.sh\n```\n\n## Image Recognition\n```shell\ncd Image_Recognition\nbash run_image_recognition.sh\n```\n\n## Citation\n```\n@article{dong2024fan,\n  title={FAN: Fourier Analysis Networks},\n  author={Yihong Dong and Ge Li and Yongding Tao and Xue Jiang and Kechi Zhang and Jia Li and Jing Su and Jun Zhang and Jingjing Xu},\n  journal={arXiv preprint arXiv:2410.02675},\n  year={2024}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYihongDong%2FFAN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYihongDong%2FFAN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYihongDong%2FFAN/lists"}