AI: Difference between revisions
(269 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= 人類如何勝過AI = | |||
[https://www.ithome.com.tw/article/154628 人類如何勝過AI?] | |||
= Applications = | = Applications = | ||
* [https://health.udn.com/health/story/6005/3034944 人何時走完全未知?美研發AI預測臨終準確度達90%] | * [https://health.udn.com/health/story/6005/3034944 人何時走完全未知?美研發AI預測臨終準確度達90%] | ||
Line 7: | Line 10: | ||
* [https://liliputing.com/2018/07/draw-this-camera-prints-crappy-drawings-of-the-things-you-photograph-diy.html Draw This camera prints crappy drawings of the things you photograph (DIY)] with Google's [https://quickdraw.withgoogle.com/ quickdraw]. | * [https://liliputing.com/2018/07/draw-this-camera-prints-crappy-drawings-of-the-things-you-photograph-diy.html Draw This camera prints crappy drawings of the things you photograph (DIY)] with Google's [https://quickdraw.withgoogle.com/ quickdraw]. | ||
* [https://www.makeuseof.com/tag/machine-learning-algorithms/ What Are Machine Learning Algorithms? Here’s How They Work] | * [https://www.makeuseof.com/tag/machine-learning-algorithms/ What Are Machine Learning Algorithms? Here’s How They Work] | ||
* [https://jamanetwork.com/journals/jama/article-abstract/2754798 How to Read Articles That Use Machine Learning] Users’ Guides to the Medical Literature | |||
* [https://www.techbang.com/posts/62754-googles-artificial-intelligence-open-source-oracle-is-three-years-old-and-its-being-used-in-a-lot-of-places-you-cant-imagine Google的人工智慧開源神器三歲了,它被用在很多你想不到的地方] Nov 2018 | * [https://www.techbang.com/posts/62754-googles-artificial-intelligence-open-source-oracle-is-three-years-old-and-its-being-used-in-a-lot-of-places-you-cant-imagine Google的人工智慧開源神器三歲了,它被用在很多你想不到的地方] Nov 2018 | ||
* [https://www.makeuseof.com/what-is-natural-language-processing-and-how-does-it-work/ What is Natural Language Processing and How Does It Work?] NLP works via preprocessing the text and then running it through the machine learning-trained algorithm. | |||
* [https://arxiv.org/abs/2110.12112 Why Machine Learning Cannot Ignore Maximum Likelihood Estimation] van der Laan & Rose 2021 | |||
= Prompts = | |||
== Research prompts == | |||
* [https://medium.com/@KanikaBK/10-high-quality-chatgpt-prompts-that-i-use-to-research-any-topic-370289496adf 10 HIGH QUALITY ChatGPT Prompts that I use to research any Topic] | |||
* [https://medium.com/@Vugar_Ibrahimov/10-chatgpt-and-claude-ai-prompts-for-faster-academic-reading-ece583dd132c 10 ChatGPT and Claude AI Prompts for Faster Academic Reading] | |||
== Learning prompts == | |||
* [https://www.makeuseof.com/how-to-reduce-ai-hallucination/ How to Reduce AI Hallucination With These 6 Prompting Techniques] | |||
* [https://www.makeuseof.com/prompting-techniques-to-improve-chatgpt-responses/ 7 Prompting Techniques to Improve Your ChatGPT Responses] | |||
* ChatGPT Role-Playing Prompts | |||
** [https://www.pcworld.com/article/2418551/new-report-reveals-what-chatbots-are-used-for.html New report shows the truth of how people actually use AI chatbots] | |||
** [https://www.aiforeditors.com/post/chatgpt-role-playing-prompts-a-guide-for-editors ChatGPT Role-Playing Prompts: A Guide for Editors] | |||
* [https://youtu.be/tEn5BjRY8Uw How to Learn Python FAST with ChatGPT?] | |||
** Can you create a roadmap to learn python for data analysis | |||
** Can you create a roadmap to learn python for data analysis in 3 months with weekly plan and resources for learning | |||
** Can you create a roadmap to learn python for data analysis in 3 months with weekly plan, including resources and links for each week and youtube video links | |||
** Explain while loop in python to a child | |||
* [https://youtu.be/VznoKyh6AXs How to learn to code FAST using ChatGPT] | |||
** Give me a study plan to learn python for data science | |||
** Give me a study plan to learn python for data science with resources and a timeline | |||
** [https://youtu.be/VznoKyh6AXs?t=861 Sublime] is used | |||
** (After ask a question and get an answer). Let's take this step by step. | |||
* [https://www.reddit.com/r/PromptDesign/comments/13fddpf/10_most_interesting_prompt_types_to_unlock_ais/?utm_source=share&utm_medium=web2x&context=3 10 Most Interesting Prompt Types: to Unlock AI's Creativity for Your Work or Business] | |||
* [https://twitter.com/itaiyanai/status/1658430045403111430 Ask generative AI to be that colleague]. Ask 'As a physicist, describe how cancer cells interact with their environment', or 'As a chemist..', 'As a developmental biologist..', 'As an economist..' 'As an electrician.' ... | |||
* [https://www.makeuseof.com/online-courses-mastering-ai-prompt-engineering/ The Top 5 Online Courses for Mastering AI Prompt Engineering] | |||
* [https://readmedium.com/how-i-won-singapores-gpt-4-prompt-engineering-competition-34c195a93d41 How I Won Singapore’s GPT-4 Prompt Engineering Competition] | |||
= Carbon footprint = | |||
[https://www.pcworld.com/article/2388675/free-ai-is-not-sustainable-soon-we-will-have-to-pay.html Free AI isn’t sustainable — and we’ll be paying for it soon enough]. | |||
= ChatGPT = | |||
https://chat.openai.com, https://openai.com/blog/chatgpt-plus/ | |||
* https://openai.com/blog/chatgpt/ | |||
* [https://mobilesms.io/blog/openai-without-phone/ Sign Up to OpenAI without Your Phone Number | OpenAI SMS Verification], | |||
** https://smsverification.xyz/, | |||
** [https://www.makeuseof.com/register-for-chat-services-without-phone-number/ How to Register for ChatGPT, Telegram, WhatsApp and Other Services Without a Phone Number], [https://www.howtogeek.com/712590/how-to-sign-up-for-signal-or-telegram-anonymously/ How to Sign up for Signal or Telegram Anonymously] | |||
** [https://youtu.be/uCoUkjxwNwE 免费获取虚拟手机号!推荐这12种最佳方式!!免注册、轻松搞定接码!2023 年最新教程!] | |||
* https://beta.openai.com/overview, [https://beta.openai.com/examples examples] | |||
* Tip: use '''SHIFT + ENTER''' to add a line break for entering some code. | |||
* [https://www.msn.com/en-us/news/technology/this-ai-chatbot-is-dominating-social-media-with-its-frighteningly-good-essays/ar-AA14W12d This AI chatbot is dominating social media with its frighteningly good essays] 2022/12/5 | |||
* [https://twitter.com/AlphaSignalAI/status/1600209930954321920 how it actually works?] | |||
* [https://twitter.com/sama/status/1601731295792414720 ChatGPT is incredibly limited, but good enough at some things to create a misleading impression of greatness] | |||
* [https://twitter.com/neelroop/status/1603821482723135488 Plagiarism is an outdated concept for AI] | |||
* [https://www.theatlantic.com/technology/archive/2022/12/openai-chatgpt-writing-high-school-english-essay/672412/ The End of High-School English] | |||
* [https://github.com/wong2/chat-gpt-google-extension?utm_source=pocket_reader chatGPT google extension] -A browser extension to display ChatGPT response alongside search engine results | |||
* [https://www.makeuseof.com/gpt-models-explained-and-compared/ GPT-1 to GPT-4: Each of OpenAI's GPT Models Explained and Compared] | |||
* Tokens | |||
** [https://www.makeuseof.com/what-is-chatgpt-token-limit-can-you-exceed-it/ What Is the ChatGPT Token Limit and Can You Exceed It?] | |||
** https://openai.com/api/pricing/. 0.04 - 2¢ per 1k tokens/words (language models). You can think of tokens as pieces of words, where 1,000 tokens is about 750 words. How much does the OpenAI’s cost per session? About $0.05 to $0.1, if you send 25 to 50 requests. $18.00 free trial. Cost depends on how many words in the input and output at $0.000002 per word. | |||
* [https://www.makeuseof.com/online-communities-to-learn-about-ai/ 9 Communities for Beginners to Learn About AI Tools] | |||
== Down == | |||
* [https://downforeveryoneorjustme.com/chatgpt Down for Everyone or Just Me] | |||
* [https://www.howtogeek.com/883074/is-chatgpt-down-heres-what-to-do/ Is ChatGPT Down? Here’s What to Do] | |||
== Network error == | |||
[https://help.openai.com/en/articles/9247338-network-recommendations-for-chatgpt-errors-on-web-and-apps Network recommendations for ChatGPT errors on web and apps] | |||
== Plugins == | |||
[https://www.howtogeek.com/893399/how-to-enable-chatgpts-web-browsing-and-plugins/ How to Enable ChatGPT’s Web Browsing and Plugins] | |||
== Use == | |||
* [https://quickref.me/chatgpt cheat sheet] | |||
* [https://www.makeuseof.com/best-chatgpt-prompts-on-github/ The 14 Best ChatGPT Prompts on GitHub] | |||
* [https://www.makeuseof.com/use-chatgpt-write-work-emails/ How to Use ChatGPT for Writing Difficult Emails at Work] | |||
* [https://www.makeuseof.com/can-chatgpt-be-used-as-proofreader/ Can ChatGPT Be Used as a Proofreader?] | |||
* [https://www.makeuseof.com/tools-use-ai-to-make-presentation/ The 7 Best Tools That Use AI to Make Presentations for You] | |||
** https://mindshow.fun/ 快速演示你的想法 Auto-generated Slides | |||
* Learn a language | |||
** [https://www.makeuseof.com/how-chatgpt-plus-can-help-you-learn-a-language/ How ChatGPT Plus Can Help You Learn a Language] | |||
** [https://www.howtogeek.com/chatgpt-conversational-mode-to-practice-a-language/ How to Use ChatGPT's Conversational Mode to Practice a Language] | |||
* Some examples: | |||
** [https://twitter.com/AndrewYNg/status/1600284752258686976?s=20&t=48tAUjSNvG8VNdPQNrKQBQ Andrew Ng] | |||
** [https://twitter.com/simocristea/status/1599834929751547905 Bioinformatics] | |||
** [https://blog.ephorie.de/chatgpt-can-create-datasets-program-in-r-and-when-it-makes-an-error-it-can-fix-that-too ChatGPT can Create Datasets, Program in R… and when it makes an Error it can Fix that too!] | |||
** [https://twitter.com/dr_keithmcnulty/status/1599716570569138177 It can also update code to more modern syntax as long as the syntax predates April 2021] | |||
** http://rtutor.ai/ which is built based on R's [https://cran.rstudio.com/web/packages/openai/index.html openai] package. | |||
*** [https://www.youtube.com/watch?v=7GfyThwIF04 Bioinformatics analysis using Chatlize and ChatGPT by Pr. Steven Ge] | Tunis R User Group |Workshop 3 | |||
** [https://www.makeuseof.com/creative-ways-to-use-chatgpt-openai/ 15 Creative Ways to Use ChatGPT by OpenAI] | |||
** [https://ivelasq.rbind.io/blog/macos-rig/index.html Setting up macOS as an R data science rig in 2023] | |||
** [https://twitter.com/scaffeoa/status/1608643439868141570 Describe 20 possible generative AI use cases in detail across society that could create early impact.] | |||
== Live voice == | |||
[https://www.makeuseof.com/ways-use-chatgpt-live-voice-and-vision/ 7 Interesting Ways You Can Use ChatGPT's Live Voice and Vision] | |||
== API, Extension tools == | |||
* https://platform.openai.com/account/api-keys, [https://platform.openai.com/account/usage usage] | |||
* [https://www.makeuseof.com/chatgpt-api-complete-guide/ A Complete Guide to the ChatGPT API] | |||
* [https://github.com/Bin-Huang/chatbox/releases ChatBox], [https://www.freedidi.com/8875.html 开源的 ChatGPT API 跨平台桌面客户端,Prompt 的调试与管理工具,实现 ChatGPT Plus 的免费平替] | |||
* [https://chrome.google.com/webstore/detail/merlin-chatgpt-assistant/camppjleccjaphfdbohjdohecfnoikec Merlin ChatGPT Assistant for all Websites] | |||
* [https://chrome.google.com/webstore/detail/chatgpt-writer-write-mail/pdnenlnelpdomajfejgapbdpmjkfpjkp ChatGPT Writer - Write mail, messages with AI] | |||
== Create your GPT == | |||
[https://readmedium.com/how-i-stopped-procrastinating-with-chatgpt-2-hours-saved-each-day-82d27f76acd2 How I Stopped Procrastinating with ChatGPT — 2 Hours Saved Each Day!] | |||
== call from R == | |||
* [https://www.sumsar.net/blog/call-chatgpt-from-r/ Call ChatGPT (or really any other API) from R] | |||
* [https://github.com/samterfa/openai openai]-This R package provides an SDK to the Open AI API | |||
* [https://cran.r-project.org/web/packages/openai/index.html openai] package from CRAN & [https://github.com/irudnyts/openai github] | |||
* [https://cran.r-project.org/web/packages/askgpt/index.html askgpt] package | |||
* [https://shiny.posit.co/blog/posts/shiny-on-hugging-face/ Shiny on Hugging Face] | |||
* [https://mlverse.github.io/chattr/ chattr] package -Interact with Large Language Models in 'RStudio'. | |||
** [https://cran.r-project.org/web//packages/chattr/index.html CRAN]. | |||
** [https://blogs.rstudio.com/ai/posts/2024-04-04-chat-with-llms-using-chattr/ Chat with AI in RStudio]. | |||
** [https://www.business-science.io/code-tools/2024/05/11/chattr-chatgpt-in-r.html How to Get ChatGPT in R with chattr] | |||
* [https://elmer.tidyverse.org/?s=09 elmer] | |||
== call from Python == | |||
* [https://www.makeuseof.com/python-gpt-3-how-use/ How to Use GPT-3 With Python] | |||
* [https://www.howtogeek.com/889200/how-to-run-chatgpt-using-shellgpt-from-the-ubuntu-terminal/ How to Run ChatGPT Using ShellGPT From the Ubuntu Terminal] | |||
=== Jupyter-ai === | |||
[https://github.com/jupyterlab/jupyter-ai A generative AI extension for JupyterLab] | |||
== Bing chat == | |||
It's been 18 days but Bing chat says R 4.3.0 is not yet released. It says the latest version of R is 4.1.3. The default conversion style is balanced (blue). After I changed it to more precise (green), the results are right. | |||
== DuckDuckGo == | |||
https://duck.ai | |||
== Brave AI chatbot: Leo == | |||
[https://www.makeuseof.com/everything-leo-brave-ai/ Everything You Need to Know About Leo: Brave Browser’s AI Chatbot] | |||
== GPT-4 == | |||
* [https://www.freedidi.com/9587.html 免费使用 ChatGPT-4 的 6 种方法] | |||
** [https://chat.forefront.ai/ ForeFront AI] | |||
** [https://www.microsoft.com/zh-cn/edge/launch/newBinginEdge Microsoft Bing] | |||
** [https://play.google.com/store/apps/details?id=com.touchtype.swiftkey.beta&hl=en_US Microsoft SwiftKey Beta] | |||
** [https://ora.ai/dashboard Ora.ai] | |||
** [https://huggingface.co/spaces/ysharma/ChatGPT4 HuggingFace ChatGPT-4] | |||
* [https://openaimaster.com/how-to-use-gpt-4-for-free/ How to use GPT-4 for free] | |||
** [https://openai.nat.dev/ Nat.dev] | |||
== GPT-4o == | |||
* [https://lifehacker.com/tech/is-paying-for-chatgpt-plus-still-worth-it You Probably Don't Need to Pay for ChatGPT Anymore] | |||
* [https://www.howtogeek.com/how-to-get-more-free-chatgpt-4o-access/ How-To Get More Free ChatGPT 4o Access] | |||
== Alternatives == | |||
* [https://www.makeuseof.com/best-alternatives-chatgpt/ The 3 Best Alternatives to ChatGPT] 1/6/2023 | |||
* [https://www.howtogeek.com/875801/chatgpt-alternatives/ 7 ChatGPT AI Alternatives (Free and Paid)] 3/1/2023 | |||
== PDF == | |||
* [https://www.chatpdf.com/ chatPDF]. ChatPDF allows you to use it for free with 3 PDFs every day, each up to 120 pages. It seems I can use chatPDF as usual chatGPT after I upload/paste URL of a pdf file without signing in my account. | |||
* [https://github.com/bhaskatripathi/pdfGPT pdfGPT] | |||
* [https://www.makeuseof.com/chatgpt-apps-to-analyze-chat-with-documents-pdfs/ 6 ChatGPT Apps to Analyze and Chat With Your Documents and PDFs] | |||
* [https://www.makeuseof.com/ai-tools-answer-pdf/ 7 AI Tools That Answer Questions From Your PDFs] | |||
* [https://www.msn.com/en-us/news/technology/4-ways-ai-can-make-working-with-pdfs-easier/ar-AA1nkHpL 4 Ways AI Can Make Working With PDFs Easier] | |||
* [https://www.howtogeek.com/ai-tools-to-analyze-pdfs-for-free/ 5 AI Tools to Analyze PDFs For Free]. ChatGPT, Claude, Perplexity AI, Copilot, HuggingChat. | |||
* [https://blog.stephenturner.us/p/biorecap-r-package-for-summarizing-biorxiv-preprints-local-llm biorecap: an R package for summarizing bioRxiv preprints with a local LLM] | |||
== Word == | |||
[https://www.makeuseof.com/automate-document-creation-with-chatgpt-in-word/ How to Automate Your Document Creation With ChatGPT in Microsoft Word] | |||
== Research == | |||
* https://elicit.org/. Trained on scientific papers, and not only biomedical ones (providing real references!) | |||
** [https://youtu.be/ZGRm7XeWb_I How to use Elicit for topics that have lots of research] | |||
* [https://www.makeuseof.com/the-6-best-ai-tools-for-researchers-and-teachers/ The 6 Best AI Tools for Researchers and Teachers] | |||
** Research Rabbit | |||
** Gradescope | |||
** Education Copilot | |||
** ReadCube Papers | |||
** Consensus | |||
** Elicit | |||
* Scispace https://typeset.io/ | |||
* [https://twitter.com/MushtaqBilalPhD/status/1650044272865951747 Fake citations?], [https://chrome.google.com/webstore/detail/webchatgpt-chatgpt-with-i/lpfemeioodjbpieminkklglpmhlngfcn WebChatGPT]: ChatGPT with internet access. | |||
** To get references to journal articles, add "site:scholar.google.com" before your question. | |||
** You can do the same exercise with another scholarly database like PubMed. site:pubmed.ncbi.nlm.nih.gov What are the major causes of lung cancer? | |||
== Content writer == | |||
* [https://www.makeuseof.com/ways-to-use-ai-as-writer-editor/ 7 Responsible Ways to Use AI as a Content Writer or Editor] | |||
* [https://www.howtogeek.com/900965/how-to-use-chatgpt-to-transform-writing-into-another-format/ How to Use ChatGPT to Transform Writing Into Another Format] | |||
** Turning A Blog Post Into a YouTube Script | |||
** Changing a Technical Document Into a Popular Article | |||
** Turning a Short Story Into a Movie Script | |||
* [https://www.howtogeek.com/how-to-write-a-great-essay-with-chatgpt-without-cheating/ How to Write a Great Essay With ChatGPT Without Cheating] | |||
== Detect AI text == | |||
* [https://www.makeuseof.com/openai-launches-ai-detector-counter-chatgpt/ OpenAI Launches an AI Detector Tool to Counter ChatGPT-Generated Text] | |||
* [https://www.makeuseof.com/gptzero-detect-ai-generated-text/ What Is GPTZero? How to Use It to Detect AI-Generated Text] | |||
* [https://readmedium.com/words-and-phrases-that-show-chatgpt-generated-it-ca7e28ae8e8f Words and Phrases That Show ChatGPT Generated It] | |||
== Youtube summary == | |||
Chrome extension [https://chrome.google.com/webstore/detail/youtube-summary-with-chat/nmmicjeknamkfloonkhhcjmomieiodli YouTube Summary with ChatGPT] from [https://www.makeuseof.com/ai-chrome-extensions-summarize-youtube-videos/ 8 AI-Powered Chrome Extensions to Summarize YouTube Videos] | |||
== AutoGPT == | |||
[https://www.makeuseof.com/how-to-download-install-auto-gpt-step-by-step/ How to Download and Install Auto-GPT Step-by-Step] | |||
= Other chats = | |||
[https://www.howtogeek.com/4-ai-search-engines-i-use-every-day/ 4 AI Search Engines I Use Every Day]. Perplexity, Exa, You AI, Andi AI. | |||
== Google Bard == | |||
* [https://blog.google/technology/ai/code-with-bard/ Bard now helps you code] 4/21/2023 | |||
* [https://lifehacker.com/set-up-google-bard-extensions-1850853309 You Can Now Connect Bard to Gmail, Google Docs, YouTube, and More] | |||
== perplexity.ai == | |||
* https://www.perplexity.ai/ | |||
* [https://youtu.be/ZC3L94U0_sc 為什麼科技巨頭都愛用 Perplexity?] | |||
== You.com == | |||
[https://www.pcworld.com/article/1448609/is-you-com-a-better-google.html You.com’s AI-infused Google rival provides a tantalizing glimpse of the future] | |||
== Claude == | |||
* https://claude.ai/login, https://claude.ai/chat/. Like ChatGPT, there is no internet access. | |||
* For free plan, you can use it for a few question in a certain time period. | |||
* You can upload an image and ask it to give a story. | |||
* [https://www.makeuseof.com/claude-vs-chatgpt-which-llm-is-best/ Claude vs. ChatGPT: Which LLM Is Best for Everyday Tasks?] | |||
* [https://www.makeuseof.com/why-claude-is-better-alternative-to-chatgpt/ I've Ditched ChatGPT for This Superior Alternative: 3 Reasons Why] | |||
== Meta's LLaMA == | |||
* [https://ai.meta.com/blog/meta-llama-3/ Introducing Meta Llama 3: The most capable openly available LLM to date] 2024/4/18 | |||
* [https://huggingface.co/blog/lyogavin/llama3-airllm Run the strongest open-source LLM model: Llama3 70B with just a single 4GB GPU!] 2024/4/21. AirLLM. ''It’s not designed for real-time interactive scenarios like chatting, more suitable for data processing and other offline asynchronous scenarios.'' | |||
* [https://blog.stephenturner.us/p/create-a-free-llama-405b-llm-chatbot-github-repo-huggingface Create a free Llama 3.1 405B-powered chatbot on a GitHub repo in <1 min] | |||
=== ollamar R package === | |||
[https://www.r-bloggers.com/2024/08/use-r-to-prompt-a-local-llm-with-ollamar/ Use R to prompt a local LLM with ollamar] | |||
== Open source chats == | |||
* [https://huggingface.co/chat/ HuggingChat] | |||
** GPT4All now supports 100+ more models! [https://docs.gpt4all.io/gpt4all_chat.html#sideloading-any-ggml-model Sideloading any ggML model] | |||
** [https://www.makeuseof.com/huggingchat-vs-bing-chat-better-than-chatgpt/ HuggingChat vs. Bing Chat: Which Is the Better ChatGPT Alternative?] | |||
* [https://youtu.be/EgoHtsOgZhY Run Your Own AI Chat GPT-3 On Your Computer] llama | |||
* [https://youtu.be/IeqeGTguFwk 1 Command To Bring Home Your Very Own Robot Overlord - Text Generation Webui] | |||
** [https://github.com/oobabooga/text-generation-webui oobabooga] | |||
* [https://www.makeuseof.com/run-a-large-language-model-on-linux/ How to Run a Large Language Model on Linux (and Why You Should) ] | |||
** [https://github.com/cocktailpeanut/dalai dalai] | |||
= Run locally = | |||
* [https://freedium.cfd/https://medium.com/illumination/list-of-different-ways-to-run-llms-locally-55f7268c55a2 List of Different Ways to Run LLMs Locally] | |||
== Jan == | |||
* [https://jan.ai/ Jan], https://github.com/janhq/jan | |||
* [https://www.youtube.com/watch?v=gf8Phs2YXWU ChatGPT 最佳免费替代软件!支持本地离线运行,100%免费开源,兼容多种主流AI大模型!]. | |||
* [https://www.youtube.com/watch?v=TCHnDqFdkLw Llama 3 正式发布!性能强悍,支持AI文生图,完全免费开源!附本地安装教程!] | |||
* https://jan.ai/docs/local-api. Local Server Address: By default, Jan is only accessible on the same computer it's running on, using the address 127.0.0.1. You can change this to 0.0.0.0 to let other devices on your local network access it. However, this is less secure than allowing access from the same computer. | |||
== LM Studio == | |||
* [https://lmstudio.ai/ LM Studio]. | |||
* [https://www.xda-developers.com/run-local-llms-mac-windows-lm-studio/ Run local LLMs with ease on Mac and Windows thanks to LM Studio] | |||
* [https://www.youtube.com/watch?v=NP0s7T9Mou8 Llama3 一键本地部署 !无需GPU !100% 保证成功,轻松体验 Meta 最新的 8B、70B AI大模型!] | |||
== Ollama == | |||
* [https://readmedium.com/step-by-step-guide-to-running-latest-llm-model-meta-llama-3-on-apple-silicon-macs-m1-m2-or-m3-b9424ada6840 Step-by-Step Guide to Running Latest LLM Model Meta Llama 3 on Apple Silicon Macs (M1, M2 or M3)] | |||
* [https://jamesravey.medium.com/self-hosting-llama-3-on-a-home-server-00feeeba8174 Self-hosting Llama 3 on a home server] | |||
* [https://fleetstack.io/blog/running-open-llm-models-on-raspberry-pi-5-with-ollama Running Open LLM Models on Raspberry Pi 5 with Ollama] | |||
* [https://itsfoss.com/raspberry-pi-ollama-ai-setup/ Run LLMs Locally on Raspberry Pi Using Ollama AI] | |||
* [https://ubuntushell.com/install-alpaca-on-linux/ Alpaca]: A Linux GUI App to Manage Multiple AI Models Offline | |||
== GPT4ALL == | |||
* [https://youtu.be/kqz4nDcKctg?si=XCe-XbsoUieODjVT&t=76 Phi-3 开源大模型本地部署!能否媲美 ChatGPT、Cladue 3?] | |||
* [https://www.howtogeek.com/heres-how-to-install-your-own-uncensored-local-gpt-like-chatbot/ Here's How To Install Your Own Uncensored Local GPT-Like Chatbot] | |||
= Browser = | |||
* [https://chromewebstore.google.com/detail/sider-chatgpt-sidebar-+-g/difoiogjjojoaoomphldepapgpbgkhkb ChatGPT Sidebar] Chrome extension | |||
* [https://lifehacker.com/tech/opera-is-the-first-browser-to-support-local-ai-llms Opera Is the First Browser to Support Local AI LLMs] | |||
= BERT = | |||
* [https://www.makeuseof.com/what-is-bert-language-model-how-differ-gpt/ What Is the BERT Natural Language Processing Model and How Does It Differ From GPT?] | |||
* [https://www.makeuseof.com/gpt-vs-bert/ GPT vs. BERT: What Are the Differences Between the Two Most Popular Language Models?] | |||
= LLM = | |||
[https://towardsdatascience.com/understanding-llms-from-scratch-using-middle-school-math-e602d27ec876 Understanding LLMs from Scratch Using Middle School Math] | |||
= AI, ML and DL = | |||
[https://www.opensourceforu.com/2022/08/ai-ml-and-dl-whats-the-difference/ AI, ML and DL: What’s the Difference?] | |||
= Coding = | |||
* [https://www.scribbledata.io/blog/the-top-llms-for-code-generation-2024-edition/ The Top LLMs For Code Generation: 2024 Edition] | |||
* https://mistral.ai/news/codestral/ | |||
** [https://www.maginative.com/article/mistral-unveils-codestral-an-ai-code-assistant-trained-on-80-programming-languages/ Mistral Unveils Codestral, an AI Code Assistant Trained on 80+ Programming Languages] 5/29/2024 | |||
= Images = | |||
== Drawing == | |||
* [https://www.reviewgeek.com/151292/this-new-ai-tool-can-animate-your-childrens-drawings/ This New AI Tool Can Animate Your Children’s Drawings]. [https://sketch.metademolab.com/ Animated Drawing] by Meta. | |||
* [https://www.makeuseof.com/react-dall-e-image-generator-application-build-api/ How to Build an Image Generator in React Using the DALL-E API ] | |||
* [https://www.makeuseof.com/how-to-use-bing-image-creator-ai-art/ How to Use Bing Image Creator to Make AI Art] | |||
* [https://youtu.be/xMrilkJ21yo How To Install Stable Diffusion With Prompting Cheat Sheets] 5/21/2023 | |||
* [https://www.makeuseof.com/dall-e-3-best-image-prompts/ 8 DALL-E 3 Prompts for Your Next Image] 2024/3/28 | |||
* [https://www.makeuseof.com/best-open-source-ai-image-generators/ The 5 Best Open-Source AI Image Generators] 2024/4/23 | |||
* [https://www.makeuseof.com/create-logos-with-ai/ Using AI to Create Logos: The Pros, Cons, and Best Practices] | |||
* [https://www.youtube.com/watch?v=zOI8ePbTUSs 重磅炸弹!Stable Diffusion 3 终于开源了!] 2024/7 | |||
* [https://www.kenkoonwong.com/blog/2024-09-01-stable-diffusion-3-in-r-why-not-thanks-to-reticulate/ Stable Diffusion 3 in R? Why not? Thanks to {reticulate}] 2024/9/1 | |||
* Run it locally | |||
** [https://github.com/AUTOMATIC1111/stable-diffusion-webui Stable Diffusion web UI] | |||
== Describe images == | |||
* [https://www.makeuseof.com/use-chatgpt-vision/ 8 Ways to Use ChatGPT Vision] | |||
* [https://www.makeuseof.com/google-bard-use-image-prompts/ How to Use Image Prompts on Google Bard] | |||
== GeoSpy == | |||
https://geospy.web.app/ | |||
= Videos = | |||
* [https://youtu.be/OpYYFGJPr0A 超逼真的AI数字人,一键免费生成教程!还能克隆你自己,用这2个网站即可轻松搞定!!] 5/21/2023 零度解说 | |||
* [https://www.youtube.com/watch?v=5KC4wFTLq3E 零基礎入門 全流程AI做兒童動畫頻道,月賺1w美元|解決人物一致+嘴形問題|Creating animation channel with AI] | |||
= Music = | |||
* [https://www.makeuseof.com/google-musiclm-overview-how-to-use/ Does Google's MusicLM Live Up to the Hype?] | |||
* [https://www.howtogeek.com/i-took-googles-new-ai-music-tool-for-a-spin-heres-how-it-went/ I Took Google's New AI Music Tool for a Spin, Here's How It Went] | |||
= Text to/from speech = | |||
* [https://www.freedidi.com/8737.html 文字轉語音、語音轉文字! 這幾種方法你最好要知道] | |||
* [https://www.youtube.com/watch?v=aUcFDNyMuVc ChatTTS 最强文本转语音!一键本地安装,100%成功!效果逼真如真人,完全免费开源!] | |||
** [https://www.freedidi.com/12613.html ChatTTS 本地部署教程!目前最好用的文字转语音工具!] | |||
** [https://github.com/jianchang512/ChatTTS-ui ChatTTS-ui] | |||
** MY GPU is 4GB. By default, GPU is not used. I am using the docker compose method. Following the instruction at [https://github.com/jianchang512/ChatTTS-ui/issues/106 安装了CUDA,为什么还是为CPU呢? #106], I just need to open '''ChatTTS/core.py''' and on line 78, change "4096" to "2048". Bingo! Verify by '''nvidia-smi -l 1'''. | |||
= Bioinformatics = | |||
* [https://academic.oup.com/bib/article/23/6/bbac409/6713511 BioGPT: generative pre-trained transformer for biomedical text generation and mining] | |||
* [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9950855/ Applications of transformer-based language models in bioinformatics: a survey] 2023 | |||
* [https://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1011319 Ten quick tips for harnessing the power of ChatGPT in computational biology] 2023 | |||
* [https://huggingface.co/BioMistral BioMistral], | |||
** [https://arxiv.org/html/2402.10373v1 manuscript] | |||
** [https://anakin.ai/blog/biomistral-7b/ BioMistral-7B: Mistral 7B Based LLM for Medical Domains] | |||
** [https://www.explainx.ai/post/biomistral-a-breakthrough-in-medical-language-models Revolutionizing Healthcare with BioMistral: A Breakthrough in Medical Language Models] | |||
** [https://mistral-7b.com/try-installing-biomistral-on-your-windows-system-for-the-best-medical-llm-experience-this-local-installation-is-user-friendly-and-ensures-optimal-performance/ Try installing BioMistral on your Windows system for the best medical LLM experience. This local installation is user-friendly and ensures optimal performance]. | |||
= AI and statistics = | |||
[https://www.frontiersin.org/articles/10.3389/fdgth.2022.833912/ Artificial Intelligence and Statistics: Just the Old Wine in New Wineskins?] Faes 2022 | |||
== What are the most important statistical ideas of the past 50 years == | |||
[https://towardsdatascience.com/four-deep-learning-papers-to-read-in-june-2021-5570cc5213bb Four Deep Learning Papers to Read in June 2021] | |||
= Neural network = | |||
* [https://gigadom.in/2019/01/10/my-presentations-on-elements-of-neural-networks-deep-learning-part123/ My presentations on ‘Elements of Neural Networks & Deep Learning’ -Part1,2,3], [https://gigadom.in/2019/01/15/my-presentations-on-elements-of-neural-networks-deep-learning-parts-45/ Part4,5], [https://gigadom.in/2019/01/20/my-presentations-on-elements-of-neural-networks-deep-learning-parts-678/ Part 6,7,8] by Ganesh | |||
* [http://blog.ephorie.de/understanding-the-magic-of-neural-networks Understanding the Magic of Neural Networks] | |||
* [https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-020-03836-4 Biological interpretation of deep neural network for phenotype prediction based on gene expression] 2020 | |||
== Types of artificial neural networks == | |||
https://en.wikipedia.org/wiki/Types_of_artificial_neural_networks | |||
== neuralnet package == | |||
* https://cran.r-project.org/web/packages/neuralnet/ | |||
* [https://datascienceplus.com/fitting-neural-network-in-r/ Fitting a Neural Network in R; neuralnet package] | |||
* [http://www.michaeljgrogan.com/neural-network-modelling-neuralnet-r/ neuralnet: Train and Test Neural Networks Using R] | |||
* [https://www.analyticsvidhya.com/blog/2017/09/creating-visualizing-neural-network-in-r/ Creating & Visualizing Neural Network in R] | |||
* [https://www.kdnuggets.com/2016/08/begineers-guide-neural-networks-r.html A Beginner’s Guide to Neural Networks with R!] | |||
== nnet package == | |||
* https://cran.r-project.org/web/packages/nnet/index.html | |||
* [https://visualstudiomagazine.com/articles/2016/11/01/using-the-r-nnet-package.aspx Neural Networks Using the R nnet Package] | |||
== sauron package == | |||
[https://datascienceguts.com/2021/01/explaining-predictions-of-convolutional-neural-networks-with-sauron-package/ Explaining predictions of Convolutional Neural Networks with 'sauron' package] | |||
== OneR package == | |||
[http://blog.ephorie.de/so-what-is-ai-really So, what is AI really?] | |||
== h2o package == | |||
https://cran.r-project.org/web/packages/h2o/index.html | |||
=== shinyML package === | |||
[https://github.com/JeanBertinR/shinyML shinyML] - Compare Supervised Machine Learning Models Using Shiny App | |||
== LSBoost == | |||
[https://thierrymoudiki.github.io//blog/2020/07/31/python/r/misc/xai-boosting-2 Explainable 'AI' using Gradient Boosted randomized networks Pt2 (the Lasso)] | |||
== LightGBM/Light Gradient Boosting Machine == | |||
* https://en.wikipedia.org/wiki/LightGBM | |||
* [https://blog.alpha-analysis.com/2022/07/r-lightgbm-regression.html R LightGBM Regression] | |||
== Survival data == | |||
* [http://www.erikdrysdale.com/neuralnetsR/ Building a survival-neuralnet from scratch in base R] | |||
* [http://www.erikdrysdale.com/cox_partiallikelihood/ Gradient descent for the elastic net Cox-PH model] | |||
== Simulated neural network == | |||
[https://datageeek.com/2021/06/01/simulated-neural-network-with-bootstrapping-time-series-data/ Simulated Neural Network with Bootstrapping Time Series Data] | |||
= Languages = | |||
[https://www.techrepublic.com/article/github-the-top-10-programming-languages-for-machine-learning/ GitHub: The top 10 programming languages for machine learning] | |||
= TensorFlow = | = Keras (high level library) = | ||
Keras is a model-level library, providing high-level building blocks for developing deep-learning models. It doesn’t handle low-level operations such as tensor manipulation and differentiation. Instead, it relies on a specialized, well-optimized tensor library to do so, serving as the backend engine of Keras. | |||
Currently, the three existing backend implementations are the '''TensorFlow''' backend, the '''Theano''' backend, and the Microsoft Cognitive Toolkit ('''CNTK''') backend. | |||
On Ubuntu, we can install required packages by | |||
<syntaxhighlight lang='bash'> | |||
$ sudo apt-get install build-essential cmake git unzip \ | |||
pkg-config libopenblas-dev liblapack-dev | |||
$ sudo apt-get install python-numpy python-scipy python- matplotlib python-yaml | |||
$ sudo apt-get install libhdf5-serial-dev python-h5py | |||
$ sudo apt-get install graphviz | |||
$ sudo pip install pydot-ng | |||
$ sudo apt-get install python-opencv | |||
$ sudo pip install tensorflow # CPU only | |||
$ sudo pip install tensorflow-gpu # GPU support | |||
$ sudo pip install theano | |||
$ sudo pip install keras | |||
$ python -c "import keras; print keras.__version__" | |||
$ sudo pip install --upgrade keras $ Upgrade Keras | |||
</syntaxhighlight> | |||
To configure the backend of Keras, see [https://machinelearningmastery.com/introduction-python-deep-learning-library-keras/ Introduction to Python Deep Learning with Keras]. | |||
Example 1: [https://github.com/jiaweih14/DeepDecon DeepDecon]. | |||
* Model Definition: In train_model.py, '''model = Sequential()''' defines a neural network model using the '''Keras Sequential''' API. It adds several dense (fully connected) layers with dropout for regularization. The activation function is set to ReLU for hidden layers and sigmoid or softmax for the output layer, depending on the number of output classes. | |||
* Model Compilation: '''self.model.compile(loss=self.loss, optimizer=self.optimizer, metrics=[rmse, 'mse', metrics.mae])''' compiles the model, specifying the loss function, optimizer, and evaluation metrics. The custom RMSE function is included as one of the metrics. | |||
* Model Training: '''history = self.model.fit(X_tr, y_tr, batch_size=self.batch_size, epochs=self.epochs, validation_data=validation_data, callbacks=callbacks, shuffle=True, verbose=verbose)''' trains the model on the training data (X_tr, y_tr) with specified batch size and number of epochs. It also uses validation data for early stopping if enabled. | |||
* Early Stopping: '''if self.early_stopping''' sets up early stopping to prevent overfitting by monitoring the validation loss and stopping training if it doesn’t improve for a specified number of epochs. | |||
In the eval.py code, | |||
* Loading Models '''models = {}''' This section loads pre-trained models from specified paths and stores them in a dictionary. The custom RMSE function is used during model loading. | |||
* Calculating Differences '''def get_difference()''' This function calculates the differences between the true labels and the predicted labels. It returns the minimum and maximum differences, as well as the difference array. | |||
* Single Prediction: '''def get_single_prediction()''' This function performs a single prediction by iteratively refining the prediction interval until it stabilizes. | |||
* Batch Prediction: '''def get_prediction()''' This function performs predictions for a batch of input data by calling "get_single_prediction" for each input sample. | |||
* Main Function: This section sets up argument parsing, loads the test data, performs predictions, and saves the results to a specified file. | |||
= TensorFlow (backend library) = | |||
== Basic == | |||
* https://www.tensorflow.org/ | * https://www.tensorflow.org/ | ||
** https://www.tensorflow.org/install/docker | |||
* https://tensorflow.rstudio.com/ | * https://tensorflow.rstudio.com/ | ||
** [https://tensorflow.rstudio.com/keras/ R interface to Keras]. I followed the instruction for the installation but got an error of ''illegal operand''. The solution is to use an older version of tensorflow; see [https://github.com/rstudio/tensorflow/issues/228 here]. ''library(keras); install_keras(tensorflow = "1.5")'' (Ubuntu 16.04, Phenom(tm) II X6 1055T) | |||
** https://rviews.rstudio.com/2018/04/03/r-and-tensorflow-presentations/, [https://beta.rstudioconnect.com/ml-with-tensorflow-and-r/#1 Slides] | ** https://rviews.rstudio.com/2018/04/03/r-and-tensorflow-presentations/, [https://beta.rstudioconnect.com/ml-with-tensorflow-and-r/#1 Slides] | ||
** https://hub.docker.com/r/andrie/tensorflowr/, https://hub.docker.com/r/rocker/ml/dockerfile (outdated) | |||
* [https://hpc.nih.gov/docs/deep_learning.html Deep Learning on Biowulf] | |||
* Raspberry Pi | |||
** [https://www.raspberrypi.org/magpi/tensorflow-ai-raspberry-pi/ How to Install Tensorflow on Raspberry Pi] | |||
* Books | * Books | ||
** [https://www.manning.com/books/deep-learning-with-r Deep Learning with R] by François Chollet with J. J. Allaire, 2018. ISBN-10: 161729554X | ** [https://www.manning.com/books/deep-learning-with-r Deep Learning with R] by François Chollet with J. J. Allaire, 2018. ISBN-10: 161729554X (available on safaribooksonline) | ||
** [https://www.manning.com/books/deep-learning-with-python Deep Learning with Python] by François Chollet, 2017 (available on safaribooksonline) | |||
** [https://github.com/janishar/mit-deep-learning-book-pdf Deep Learning] by Ian Goodfellow and Yoshua Bengio and Aaron Courville | ** [https://github.com/janishar/mit-deep-learning-book-pdf Deep Learning] by Ian Goodfellow and Yoshua Bengio and Aaron Courville | ||
* [https://opensource.t-mobile.com/blog/posts/r-tensorflow-api/ Enterprise Web Services with Neural Networks Using R and TensorFlow] A [https://github.com/tmobile/r-tensorflow-api docker image] was created based on R 3.5.0 using R libraries from MRAN’s July 2nd, 2018 snapshot, as well as Miniconda 3 version 4.4.10 for python. | |||
* Deep Learning Glossary | |||
** http://www.wildml.com/deep-learning-glossary/ | |||
** [https://www.quora.com/What-is-an-epoch-in-deep-learning What is an epoch (related to batch) in deep learning?], [https://stackoverflow.com/questions/4752626/epoch-vs-iteration-when-training-neural-networks Epoch vs Iteration when training neural networks]. Example: if you have 1000 training examples, and your batch size is 500, then it will take 2 iterations to complete 1 epoch. Since "batch" depends on the partition of the entire samples, we need different partitions (epoches) in order to get an unbiased result. | |||
* [https://datasciencetut.com/best-books-to-learn-tensorflow/ Best Books to learn Tensorflow] | |||
== Some terms == | |||
[https://developers.google.com/machine-learning/glossary/ Machine Learning Glossary] from developers.google.com | |||
=== Tensor === | |||
[https://youtu.be/L35fFDpwIM4 Tensors for Neural Networks, Clearly Explained!!!] | |||
=== Dense layer and dropout layer === | |||
[https://www.quora.com/In-Keras-what-is-a-dense-and-a-dropout-layer In Keras, what is a "dense" and a "dropout" layer?] | |||
Fully-connected layer (= dense layer). You can choose "relu" or "sigmoid" or "softmax" activation function. | |||
=== Activation function === | |||
* [https://en.wikipedia.org/wiki/Artificial_neural_network#Neural_networks_as_functions Artificial neural network -> Neural networks as functions] <math>\textstyle f (x) = K \left(\sum_i w_i g_i(x)\right) </math> where K (commonly referred to as the ''activation function'') is some predefined function, such as the '''hyperbolic tangent''' or '''sigmoid function''' or '''softmax function''' or '''rectifier function'''. | |||
* [https://en.wikipedia.org/wiki/Rectifier_(neural_networks) Rectifier/ReLU] f(x) = max(0, x). | |||
* [https://en.wikipedia.org/wiki/Sigmoid_function Sigmoid]. Binary problem. Logistic function and hyperbolic tangent tanh(x) are two examples of sigmoid functions. | |||
* [https://en.wikipedia.org/wiki/Softmax_function#Applications Softmax]. Multiclass classification. | |||
=== Backpropagation === | |||
https://en.wikipedia.org/wiki/Backpropagation | |||
=== Convolutional network === | |||
https://en.wikipedia.org/wiki/Convolutional_neural_network | |||
== Deep Learning with Python == | |||
[https://github.com/fchollet/deep-learning-with-python-notebooks Jupyter notebooks for the code samples of the book "Deep Learning with Python"] | |||
<syntaxhighlight lang='python'> | |||
sudo apt install python3-pip python3-dev | |||
sudo apt install build-essential cmake git unzip \ | |||
pkg-config libopenblas-dev liblapack-dev | |||
sudo apt-get install python3-numpy python3-scipy python3-matplotlib \ | |||
python3-yaml | |||
sudo apt install libhdf5-serial-dev python3-h5py | |||
sudo apt install graphviz | |||
sudo pip3 install pydot-ng | |||
# sudo apt-get install python-opencv | |||
# https://stackoverflow.com/questions/37188623/ubuntu-how-to-install-opencv-for-python3 | |||
# https://askubuntu.com/questions/783956/how-to-install-opencv-3-1-for-python-3-5-on-ubuntu-16-04-lts | |||
sudo pip3 install keras | |||
</syntaxhighlight> | |||
=== Colorize black-and-white photos === | |||
[https://joshuacook.netlify.app/post/colorizer-demo/ Colorize black-and-white photos] | |||
== Keras using R == | |||
* [https://github.com/jjallaire/deep-learning-with-r-notebooks R Markdown Notebooks for "Deep Learning with R"] | |||
* [https://keras.rstudio.com/ R interface to Keras] | |||
* [https://finnstats.com/index.php/2021/04/10/neural-network-in-r/ Deep Neural Network in R] | |||
* [https://docs.google.com/presentation/d/1UGg5cQwiEgdjjjQTb7enI2l0kDhzjbneIFpI8JaFjVU/edit?usp=sharing Python vs R] | |||
* Derivative of a tensor operation: the gradient | |||
** Define loss_value = f(W) = dot(W, x) | |||
** W1 = W0 - step * gradient(f)(W0) | |||
* Stochastic gradient descent | |||
* Tensor operations: | |||
** relu(x) = max(0, x) | |||
** Each neural layer from our first network example transforms its input data:'''output = relu(dot(W, input) + b)''' where W and b are the ''weights'' or ''trainable parameters'' of the layer. | |||
Training process: | |||
# Draw a batch of X and Y | |||
# Run the network on x (a step called the forward pass) to obtain predictions y_pred. | |||
#* How many '''layers''' to use. | |||
#* How many “hidden '''units'''” to chose for each layer. | |||
# Compute the loss of the network on the batch | |||
#* '''loss''' | |||
#* '''optimizer''': determines how learning proceeds (how the network will be updated based on the loss function). It implements a specific variant of stochastic gradient descent (SGD). | |||
#* '''metrics''' | |||
# Update all weights of the network in a way that slightly reduces the loss on this batch. | |||
#* '''batch_size''' | |||
#* '''epochs''' (=iteration over all samples in a ''batch_size'' of samples) | |||
Keras (in order to use Keras, you need to install TensorFlow or CNTK or Theano): | |||
# Define your training data: input tensors and target tensors. | |||
# Define a network of layers (or '''model'''). Two ways to define a model: | |||
## using the '''keras_model_sequential()''' function (only for linear stacks of layers, which is the most common network architecture by far) or <syntaxhighlight lang='rsplus'> | |||
model <- keras_model_sequential() %>% | |||
layer_dense(units = 32, input_shape = c(784)) %>% | |||
layer_dense(units = 10, activation = "softmax") | |||
</syntaxhighlight> | |||
## the functional API (for directed acyclic graphs of layers, which let you build completely arbitrary architectures) <syntaxhighlight lang='rsplus'> | |||
input_tensor <- layer_input(shape = c(784)) | |||
output_tensor <- input_tensor %>% | |||
layer_dense(units = 32, activation = "relu") %>% | |||
layer_dense(units = 10, activation = "softmax") | |||
model <- keras_model(inputs = input_tensor, outputs = output_tensor) | |||
</syntaxhighlight> | |||
# '''Compile''' the learning process by choosing a '''loss''' function, an '''optimizer''', and some '''metrics''' to monitor. <syntaxhighlight lang='rsplus'> | |||
model %>% compile( | |||
optimizer = optimizer_rmsprop(lr = 0.0001), | |||
loss = "mse", | |||
metrics = c("accuracy") | |||
) | |||
</syntaxhighlight> | |||
# Iterate on your training data by calling the '''fit()''' method of your model. <syntaxhighlight lang='rsplus'> | |||
model %>% fit(input_tensor, target_tensor, batch_size = 128, epochs = 10) | |||
</syntaxhighlight> | |||
=== Custom loss function === | |||
[https://towardsdatascience.com/custom-loss-functions-for-deep-learning-predicting-home-values-with-keras-for-r-532c9e098d1f Custom Loss functions for Deep Learning: Predicting Home Values with Keras for R] | |||
=== Metrics === | |||
https://machinelearningmastery.com/custom-metrics-deep-learning-keras-python/ | |||
== Docker RStudio IDE == | |||
Assume we are using rocker/rstudio IDE, we need to install some packages first in the OS. | |||
<syntaxhighlight lang='bash'> | |||
$ docker run -d -p 8787:8787 -e USER=XXX -e PASSWORD=XXX --name rstudio rocker/rstudio | |||
$ docker exec -it rstudio bash | |||
# apt update | |||
# apt install python-pip python-dev | |||
# pip install virtualenv | |||
</syntaxhighlight> | |||
And then in R, | |||
<syntaxhighlight lang='bash'> | |||
install.packages("keras") | |||
library(keras) | |||
install_keras(tensorflow = "1.5") | |||
</syntaxhighlight> | |||
== Use your own Dockerfile == | |||
[https://towardsdatascience.com/data-science-for-startups-containers-d1d785bfe5b Data Science for Startups: Containers] Building reproducible setups for machine learning | |||
== Some examples == | |||
See [https://tensorflow.rstudio.com/keras/articles/examples/ Tensorflow for R] from RStudio for several examples. | |||
=== [https://jjallaire.github.io/deep-learning-with-r-notebooks/notebooks/3.4-classifying-movie-reviews.nb.html Binary data] (Chapter 3.4) === | |||
* The final layer will use a ''sigmoid'' activation so as to output a probability (a score between 0 and 1, indicating how likely the sample is to have the target “1”. | |||
* A ''relu'' (rectified linear unit) is a function meant to zero-out negative values, while a ''sigmoid'' “squashes” arbitrary values into the [0, 1] interval, thus outputting something that can be interpreted as a probability. | |||
:<syntaxhighlight lang='rsplus'> | |||
library(keras) | |||
imdb <- dataset_imdb(num_words = 10000) | |||
c(c(train_data, train_labels), c(test_data, test_labels)) %<-% imdb | |||
# Preparing the data | |||
vectorize_sequences <- function(sequences, dimension = 10000) {...} | |||
x_train <- vectorize_sequences(train_data) | |||
x_test <- vectorize_sequences(test_data) | |||
y_train <- as.numeric(train_labels) | |||
y_test <- as.numeric(test_labels) | |||
# Build the network | |||
## Two intermediate layers with 16 hidden units each | |||
## The final layer will output the scalar prediction | |||
model <- keras_model_sequential() %>% | |||
layer_dense(units = 16, activation = "relu", input_shape = c(10000)) %>% | |||
layer_dense(units = 16, activation = "relu") %>% | |||
layer_dense(units = 1, activation = "sigmoid") | |||
model %>% compile( | |||
optimizer = "rmsprop", | |||
loss = "binary_crossentropy", | |||
metrics = c("accuracy") | |||
) | |||
model %>% fit(x_train, y_train, epochs = 4, batch_size = 512) | |||
## Error in py_call_impl(callable, dots$args, dots$keywords) : MemoryError: | |||
## 10.3GB memory is necessary on my 16GB machine | |||
# Validation | |||
results <- model %>% evaluate(x_test, y_test) | |||
# Prediction on new data | |||
model %>% predict(x_test[1:10,]) | |||
</syntaxhighlight> | |||
=== [https://jjallaire.github.io/deep-learning-with-r-notebooks/notebooks/3.5-classifying-newswires.nb.html Multi class data] (Chapter 3.5) === | |||
* Goal: build a network to classify Reuters newswires into 46 different mutually-exclusive topics. | |||
* You end the network with a dense layer of size 46. This means for each input sample, the network will output a 46-dimensional vector. Each entry in this vector (each dimension) will encode a different output class. | |||
* The last layer uses a '''softmax''' activation. You saw this pattern in the MNIST example. It means the network will output a probability distribution over the 46 different output classes: that is, for every input sample, the network will produce a 46-dimensional output vector, where output[[i]] is the probability that the sample belongs to class i. The 46 scores will sum to 1. | |||
:<syntaxhighlight lang='rsplus'> | |||
library(keras) | |||
reuters <- dataset_reuters(num_words = 10000) | |||
c(c(train_data, train_labels), c(test_data, test_labels)) %<-% reuters | |||
model <- keras_model_sequential() %>% | |||
layer_dense(units = 64, activation = "relu", input_shape = c(10000)) %>% | |||
layer_dense(units = 64, activation = "relu") %>% | |||
layer_dense(units = 46, activation = "softmax") | |||
model %>% compile( | |||
optimizer = "rmsprop", | |||
loss = "categorical_crossentropy", | |||
metrics = c("accuracy") | |||
) | |||
history <- model %>% fit( | |||
partial_x_train, | |||
partial_y_train, | |||
epochs = 9, | |||
batch_size = 512, | |||
validation_data = list(x_val, y_val) | |||
) | |||
results <- model %>% evaluate(x_test, one_hot_test_labels) | |||
# Prediction on new data | |||
predictions <- model %>% predict(x_test) | |||
</syntaxhighlight> | |||
* MNIST dataset. | |||
** https://tensorflow.rstudio.com/keras/articles/examples/mnist_cnn.html | |||
** https://github.com/rstudio/keras/blob/master/vignettes/examples/mnist_cnn.R | |||
** https://hpc.nih.gov/docs/deep_learning.html#kerasR | |||
=== [https://jjallaire.github.io/deep-learning-with-r-notebooks/notebooks/3.6-predicting-house-prices.nb.html Regression data] (Chapter 3.6) === | |||
* Because so few samples are available, we will be using a very small network with two hidden layers. In general, the less training data you have, the worse overfitting will be, and using a small network is one way to mitigate overfitting. | |||
* Our network ends with a single unit, and no activation (i.e. it will be linear layer). This is a typical setup for scalar regression (i.e. regression where we are trying to predict a single continuous value). Applying an activation function would constrain the range that the output can take. Here, because the last layer is purely linear, the network is free to learn to predict values in any range. | |||
* We are also monitoring a new metric during training: '''mae'''. This stands for Mean Absolute Error. | |||
:<syntaxhighlight lang='rsplus'> | |||
library(keras) | |||
dataset <- dataset_boston_housing() | |||
c(c(train_data, train_targets), c(test_data, test_targets)) %<-% dataset | |||
build_model <- function() { | |||
model <- keras_model_sequential() %>% | |||
layer_dense(units = 64, activation = "relu", | |||
input_shape = dim(train_data)[[2]]) %>% | |||
layer_dense(units = 64, activation = "relu") %>% | |||
layer_dense(units = 1) | |||
model %>% compile( | |||
optimizer = "rmsprop", | |||
loss = "mse", | |||
metrics = c("mae") | |||
) | |||
} | |||
# K-fold CV | |||
k <- 4 | |||
indices <- sample(1:nrow(train_data)) | |||
folds <- cut(1:length(indices), breaks = k, labels = FALSE) | |||
num_epochs <- 100 | |||
all_scores <- c() | |||
for (i in 1:k) { | |||
cat("processing fold #", i, "\n") | |||
# Prepare the validation data: data from partition # k | |||
val_indices <- which(folds == i, arr.ind = TRUE) | |||
val_data <- train_data[val_indices,] | |||
val_targets <- train_targets[val_indices] | |||
# Prepare the training data: data from all other partitions | |||
partial_train_data <- train_data[-val_indices,] | |||
partial_train_targets <- train_targets[-val_indices] | |||
# Build the Keras model (already compiled) | |||
model <- build_model() | |||
# Train the model (in silent mode, verbose=0) | |||
model %>% fit(partial_train_data, partial_train_targets, | |||
epochs = num_epochs, batch_size = 1, verbose = 0) | |||
# Evaluate the model on the validation data | |||
results <- model %>% evaluate(val_data, val_targets, verbose = 0) | |||
all_scores <- c(all_scores, results$mean_absolute_error) | |||
} | |||
</syntaxhighlight> | |||
= PyTorch = | = PyTorch = | ||
[https://longhowlam.wordpress.com/2018/12/17/an-r-shiny-app-to-recognize-flower-species/ An R Shiny app to recognize flower species] | [https://longhowlam.wordpress.com/2018/12/17/an-r-shiny-app-to-recognize-flower-species/ An R Shiny app to recognize flower species] | ||
= Google Cloud Platform = | |||
* [https://towardsdatascience.com/choosing-between-tensorflow-keras-bigquery-ml-and-automl-natural-language-for-text-classification-6b1c9fc21013 Choosing between TensorFlow/Keras, BigQuery ML, and AutoML Natural Language for text classification] Comparing text classification done three ways on Google Cloud Platform | |||
= Amazon = | |||
[https://www.amazon.science/latest-news/machine-learning-course-free-online-from-amazon-machine-learning-university?s=09 Amazon's Machine Learning University is making its online courses available to the public] | |||
= Workshops = | |||
[https://blog.revolutionanalytics.com/2019/01/notebooks-from-the-practical-ai-workshop.html Notebooks from the Practical AI Workshop] 2019 | |||
= OpenML.org = | |||
[https://github.com/openml/openml-r R interface to OpenML.org] | |||
= Biology = | |||
* [https://www.sciencedirect.com/science/article/pii/S0092867418316295 Predicting Splicing from Primary Sequence with Deep Learning] Jaganathan et al 2018 | |||
* [https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-019-2617-8 Intelligent diagnosis with Chinese electronic medical records based on convolutional neural networks] Li et al BMC Bioinformatics 2019 | |||
* [https://onlinelibrary.wiley.com/doi/abs/10.1002/sim.9564?campaign=woletoc DL 101: Basic introduction to deep learning with its application in biomedical related fields] 2022 |
Latest revision as of 21:44, 9 November 2024
人類如何勝過AI
Applications
- 人何時走完全未知?美研發AI預測臨終準確度達90%
- 美國FDA首次批准AI醫療儀器上市,能自動即時偵測糖尿病視網膜病變
- 在家養老-科技幫大忙
- 病理研究有新幫手,Google以AR顯微鏡結合深度學習即時發現癌細胞
- This New App Is Like Shazam for Your Nature Photos. Seek App.
- Draw This camera prints crappy drawings of the things you photograph (DIY) with Google's quickdraw.
- What Are Machine Learning Algorithms? Here’s How They Work
- How to Read Articles That Use Machine Learning Users’ Guides to the Medical Literature
- Google的人工智慧開源神器三歲了,它被用在很多你想不到的地方 Nov 2018
- What is Natural Language Processing and How Does It Work? NLP works via preprocessing the text and then running it through the machine learning-trained algorithm.
- Why Machine Learning Cannot Ignore Maximum Likelihood Estimation van der Laan & Rose 2021
Prompts
Research prompts
- 10 HIGH QUALITY ChatGPT Prompts that I use to research any Topic
- 10 ChatGPT and Claude AI Prompts for Faster Academic Reading
Learning prompts
- How to Reduce AI Hallucination With These 6 Prompting Techniques
- 7 Prompting Techniques to Improve Your ChatGPT Responses
- ChatGPT Role-Playing Prompts
- How to Learn Python FAST with ChatGPT?
- Can you create a roadmap to learn python for data analysis
- Can you create a roadmap to learn python for data analysis in 3 months with weekly plan and resources for learning
- Can you create a roadmap to learn python for data analysis in 3 months with weekly plan, including resources and links for each week and youtube video links
- Explain while loop in python to a child
- How to learn to code FAST using ChatGPT
- Give me a study plan to learn python for data science
- Give me a study plan to learn python for data science with resources and a timeline
- Sublime is used
- (After ask a question and get an answer). Let's take this step by step.
- Ask generative AI to be that colleague. Ask 'As a physicist, describe how cancer cells interact with their environment', or 'As a chemist..', 'As a developmental biologist..', 'As an economist..' 'As an electrician.' ...
Carbon footprint
Free AI isn’t sustainable — and we’ll be paying for it soon enough.
ChatGPT
https://chat.openai.com, https://openai.com/blog/chatgpt-plus/
- https://openai.com/blog/chatgpt/
- Sign Up to OpenAI without Your Phone Number | OpenAI SMS Verification,
- https://beta.openai.com/overview, examples
- Tip: use SHIFT + ENTER to add a line break for entering some code.
- This AI chatbot is dominating social media with its frighteningly good essays 2022/12/5
- how it actually works?
- ChatGPT is incredibly limited, but good enough at some things to create a misleading impression of greatness
- Plagiarism is an outdated concept for AI
- The End of High-School English
- chatGPT google extension -A browser extension to display ChatGPT response alongside search engine results
- GPT-1 to GPT-4: Each of OpenAI's GPT Models Explained and Compared
- Tokens
- What Is the ChatGPT Token Limit and Can You Exceed It?
- https://openai.com/api/pricing/. 0.04 - 2¢ per 1k tokens/words (language models). You can think of tokens as pieces of words, where 1,000 tokens is about 750 words. How much does the OpenAI’s cost per session? About $0.05 to $0.1, if you send 25 to 50 requests. $18.00 free trial. Cost depends on how many words in the input and output at $0.000002 per word.
Down
Network error
Network recommendations for ChatGPT errors on web and apps
Plugins
How to Enable ChatGPT’s Web Browsing and Plugins
Use
- cheat sheet
- The 14 Best ChatGPT Prompts on GitHub
- How to Use ChatGPT for Writing Difficult Emails at Work
- Can ChatGPT Be Used as a Proofreader?
- The 7 Best Tools That Use AI to Make Presentations for You
- https://mindshow.fun/ 快速演示你的想法 Auto-generated Slides
- Learn a language
- Some examples:
- Andrew Ng
- Bioinformatics
- ChatGPT can Create Datasets, Program in R… and when it makes an Error it can Fix that too!
- It can also update code to more modern syntax as long as the syntax predates April 2021
- http://rtutor.ai/ which is built based on R's openai package.
- Bioinformatics analysis using Chatlize and ChatGPT by Pr. Steven Ge | Tunis R User Group |Workshop 3
- 15 Creative Ways to Use ChatGPT by OpenAI
- Setting up macOS as an R data science rig in 2023
- Describe 20 possible generative AI use cases in detail across society that could create early impact.
Live voice
7 Interesting Ways You Can Use ChatGPT's Live Voice and Vision
API, Extension tools
- https://platform.openai.com/account/api-keys, usage
- A Complete Guide to the ChatGPT API
- ChatBox, 开源的 ChatGPT API 跨平台桌面客户端,Prompt 的调试与管理工具,实现 ChatGPT Plus 的免费平替
- Merlin ChatGPT Assistant for all Websites
- ChatGPT Writer - Write mail, messages with AI
Create your GPT
How I Stopped Procrastinating with ChatGPT — 2 Hours Saved Each Day!
call from R
- Call ChatGPT (or really any other API) from R
- openai-This R package provides an SDK to the Open AI API
- openai package from CRAN & github
- askgpt package
- Shiny on Hugging Face
- chattr package -Interact with Large Language Models in 'RStudio'.
- elmer
call from Python
Jupyter-ai
A generative AI extension for JupyterLab
Bing chat
It's been 18 days but Bing chat says R 4.3.0 is not yet released. It says the latest version of R is 4.1.3. The default conversion style is balanced (blue). After I changed it to more precise (green), the results are right.
DuckDuckGo
Brave AI chatbot: Leo
Everything You Need to Know About Leo: Brave Browser’s AI Chatbot
GPT-4
GPT-4o
Alternatives
- The 3 Best Alternatives to ChatGPT 1/6/2023
- 7 ChatGPT AI Alternatives (Free and Paid) 3/1/2023
- chatPDF. ChatPDF allows you to use it for free with 3 PDFs every day, each up to 120 pages. It seems I can use chatPDF as usual chatGPT after I upload/paste URL of a pdf file without signing in my account.
- pdfGPT
- 6 ChatGPT Apps to Analyze and Chat With Your Documents and PDFs
- 7 AI Tools That Answer Questions From Your PDFs
- 4 Ways AI Can Make Working With PDFs Easier
- 5 AI Tools to Analyze PDFs For Free. ChatGPT, Claude, Perplexity AI, Copilot, HuggingChat.
- biorecap: an R package for summarizing bioRxiv preprints with a local LLM
Word
How to Automate Your Document Creation With ChatGPT in Microsoft Word
Research
- https://elicit.org/. Trained on scientific papers, and not only biomedical ones (providing real references!)
- The 6 Best AI Tools for Researchers and Teachers
- Research Rabbit
- Gradescope
- Education Copilot
- ReadCube Papers
- Consensus
- Elicit
- Scispace https://typeset.io/
- Fake citations?, WebChatGPT: ChatGPT with internet access.
- To get references to journal articles, add "site:scholar.google.com" before your question.
- You can do the same exercise with another scholarly database like PubMed. site:pubmed.ncbi.nlm.nih.gov What are the major causes of lung cancer?
Content writer
- 7 Responsible Ways to Use AI as a Content Writer or Editor
- How to Use ChatGPT to Transform Writing Into Another Format
- Turning A Blog Post Into a YouTube Script
- Changing a Technical Document Into a Popular Article
- Turning a Short Story Into a Movie Script
- How to Write a Great Essay With ChatGPT Without Cheating
Detect AI text
- OpenAI Launches an AI Detector Tool to Counter ChatGPT-Generated Text
- What Is GPTZero? How to Use It to Detect AI-Generated Text
- Words and Phrases That Show ChatGPT Generated It
Youtube summary
Chrome extension YouTube Summary with ChatGPT from 8 AI-Powered Chrome Extensions to Summarize YouTube Videos
AutoGPT
How to Download and Install Auto-GPT Step-by-Step
Other chats
4 AI Search Engines I Use Every Day. Perplexity, Exa, You AI, Andi AI.
Google Bard
perplexity.ai
You.com
You.com’s AI-infused Google rival provides a tantalizing glimpse of the future
Claude
- https://claude.ai/login, https://claude.ai/chat/. Like ChatGPT, there is no internet access.
- For free plan, you can use it for a few question in a certain time period.
- You can upload an image and ask it to give a story.
- Claude vs. ChatGPT: Which LLM Is Best for Everyday Tasks?
- I've Ditched ChatGPT for This Superior Alternative: 3 Reasons Why
Meta's LLaMA
- Introducing Meta Llama 3: The most capable openly available LLM to date 2024/4/18
- Run the strongest open-source LLM model: Llama3 70B with just a single 4GB GPU! 2024/4/21. AirLLM. It’s not designed for real-time interactive scenarios like chatting, more suitable for data processing and other offline asynchronous scenarios.
- Create a free Llama 3.1 405B-powered chatbot on a GitHub repo in <1 min
ollamar R package
Use R to prompt a local LLM with ollamar
Open source chats
- HuggingChat
- GPT4All now supports 100+ more models! Sideloading any ggML model
- HuggingChat vs. Bing Chat: Which Is the Better ChatGPT Alternative?
- Run Your Own AI Chat GPT-3 On Your Computer llama
- 1 Command To Bring Home Your Very Own Robot Overlord - Text Generation Webui
- How to Run a Large Language Model on Linux (and Why You Should)
Run locally
Jan
- Jan, https://github.com/janhq/jan
- ChatGPT 最佳免费替代软件!支持本地离线运行,100%免费开源,兼容多种主流AI大模型!.
- Llama 3 正式发布!性能强悍,支持AI文生图,完全免费开源!附本地安装教程!
- https://jan.ai/docs/local-api. Local Server Address: By default, Jan is only accessible on the same computer it's running on, using the address 127.0.0.1. You can change this to 0.0.0.0 to let other devices on your local network access it. However, this is less secure than allowing access from the same computer.
LM Studio
- LM Studio.
- Run local LLMs with ease on Mac and Windows thanks to LM Studio
- Llama3 一键本地部署 !无需GPU !100% 保证成功,轻松体验 Meta 最新的 8B、70B AI大模型!
Ollama
- Step-by-Step Guide to Running Latest LLM Model Meta Llama 3 on Apple Silicon Macs (M1, M2 or M3)
- Self-hosting Llama 3 on a home server
- Running Open LLM Models on Raspberry Pi 5 with Ollama
- Run LLMs Locally on Raspberry Pi Using Ollama AI
- Alpaca: A Linux GUI App to Manage Multiple AI Models Offline
GPT4ALL
- Phi-3 开源大模型本地部署!能否媲美 ChatGPT、Cladue 3?
- Here's How To Install Your Own Uncensored Local GPT-Like Chatbot
Browser
- ChatGPT Sidebar Chrome extension
- Opera Is the First Browser to Support Local AI LLMs
BERT
- What Is the BERT Natural Language Processing Model and How Does It Differ From GPT?
- GPT vs. BERT: What Are the Differences Between the Two Most Popular Language Models?
LLM
Understanding LLMs from Scratch Using Middle School Math
AI, ML and DL
AI, ML and DL: What’s the Difference?
Coding
Images
Drawing
- This New AI Tool Can Animate Your Children’s Drawings. Animated Drawing by Meta.
- How to Build an Image Generator in React Using the DALL-E API
- How to Use Bing Image Creator to Make AI Art
- How To Install Stable Diffusion With Prompting Cheat Sheets 5/21/2023
- 8 DALL-E 3 Prompts for Your Next Image 2024/3/28
- The 5 Best Open-Source AI Image Generators 2024/4/23
- Using AI to Create Logos: The Pros, Cons, and Best Practices
- 重磅炸弹!Stable Diffusion 3 终于开源了! 2024/7
- Stable Diffusion 3 in R? Why not? Thanks to {reticulate} 2024/9/1
- Run it locally
Describe images
GeoSpy
Videos
- 超逼真的AI数字人,一键免费生成教程!还能克隆你自己,用这2个网站即可轻松搞定!! 5/21/2023 零度解说
- 零基礎入門 全流程AI做兒童動畫頻道,月賺1w美元|解決人物一致+嘴形問題|Creating animation channel with AI
Music
- Does Google's MusicLM Live Up to the Hype?
- I Took Google's New AI Music Tool for a Spin, Here's How It Went
Text to/from speech
- 文字轉語音、語音轉文字! 這幾種方法你最好要知道
- ChatTTS 最强文本转语音!一键本地安装,100%成功!效果逼真如真人,完全免费开源!
- ChatTTS 本地部署教程!目前最好用的文字转语音工具!
- ChatTTS-ui
- MY GPU is 4GB. By default, GPU is not used. I am using the docker compose method. Following the instruction at 安装了CUDA,为什么还是为CPU呢? #106, I just need to open ChatTTS/core.py and on line 78, change "4096" to "2048". Bingo! Verify by nvidia-smi -l 1.
Bioinformatics
- BioGPT: generative pre-trained transformer for biomedical text generation and mining
- Applications of transformer-based language models in bioinformatics: a survey 2023
- Ten quick tips for harnessing the power of ChatGPT in computational biology 2023
- BioMistral,
- manuscript
- BioMistral-7B: Mistral 7B Based LLM for Medical Domains
- Revolutionizing Healthcare with BioMistral: A Breakthrough in Medical Language Models
- Try installing BioMistral on your Windows system for the best medical LLM experience. This local installation is user-friendly and ensures optimal performance.
AI and statistics
Artificial Intelligence and Statistics: Just the Old Wine in New Wineskins? Faes 2022
What are the most important statistical ideas of the past 50 years
Four Deep Learning Papers to Read in June 2021
Neural network
- My presentations on ‘Elements of Neural Networks & Deep Learning’ -Part1,2,3, Part4,5, Part 6,7,8 by Ganesh
- Understanding the Magic of Neural Networks
- Biological interpretation of deep neural network for phenotype prediction based on gene expression 2020
Types of artificial neural networks
https://en.wikipedia.org/wiki/Types_of_artificial_neural_networks
neuralnet package
- https://cran.r-project.org/web/packages/neuralnet/
- Fitting a Neural Network in R; neuralnet package
- neuralnet: Train and Test Neural Networks Using R
- Creating & Visualizing Neural Network in R
- A Beginner’s Guide to Neural Networks with R!
nnet package
sauron package
Explaining predictions of Convolutional Neural Networks with 'sauron' package
OneR package
h2o package
https://cran.r-project.org/web/packages/h2o/index.html
shinyML package
shinyML - Compare Supervised Machine Learning Models Using Shiny App
LSBoost
Explainable 'AI' using Gradient Boosted randomized networks Pt2 (the Lasso)
LightGBM/Light Gradient Boosting Machine
Survival data
- Building a survival-neuralnet from scratch in base R
- Gradient descent for the elastic net Cox-PH model
Simulated neural network
Simulated Neural Network with Bootstrapping Time Series Data
Languages
GitHub: The top 10 programming languages for machine learning
Keras (high level library)
Keras is a model-level library, providing high-level building blocks for developing deep-learning models. It doesn’t handle low-level operations such as tensor manipulation and differentiation. Instead, it relies on a specialized, well-optimized tensor library to do so, serving as the backend engine of Keras.
Currently, the three existing backend implementations are the TensorFlow backend, the Theano backend, and the Microsoft Cognitive Toolkit (CNTK) backend.
On Ubuntu, we can install required packages by
$ sudo apt-get install build-essential cmake git unzip \ pkg-config libopenblas-dev liblapack-dev $ sudo apt-get install python-numpy python-scipy python- matplotlib python-yaml $ sudo apt-get install libhdf5-serial-dev python-h5py $ sudo apt-get install graphviz $ sudo pip install pydot-ng $ sudo apt-get install python-opencv $ sudo pip install tensorflow # CPU only $ sudo pip install tensorflow-gpu # GPU support $ sudo pip install theano $ sudo pip install keras $ python -c "import keras; print keras.__version__" $ sudo pip install --upgrade keras $ Upgrade Keras
To configure the backend of Keras, see Introduction to Python Deep Learning with Keras.
Example 1: DeepDecon.
- Model Definition: In train_model.py, model = Sequential() defines a neural network model using the Keras Sequential API. It adds several dense (fully connected) layers with dropout for regularization. The activation function is set to ReLU for hidden layers and sigmoid or softmax for the output layer, depending on the number of output classes.
- Model Compilation: self.model.compile(loss=self.loss, optimizer=self.optimizer, metrics=[rmse, 'mse', metrics.mae]) compiles the model, specifying the loss function, optimizer, and evaluation metrics. The custom RMSE function is included as one of the metrics.
- Model Training: history = self.model.fit(X_tr, y_tr, batch_size=self.batch_size, epochs=self.epochs, validation_data=validation_data, callbacks=callbacks, shuffle=True, verbose=verbose) trains the model on the training data (X_tr, y_tr) with specified batch size and number of epochs. It also uses validation data for early stopping if enabled.
- Early Stopping: if self.early_stopping sets up early stopping to prevent overfitting by monitoring the validation loss and stopping training if it doesn’t improve for a specified number of epochs.
In the eval.py code,
- Loading Models models = {} This section loads pre-trained models from specified paths and stores them in a dictionary. The custom RMSE function is used during model loading.
- Calculating Differences def get_difference() This function calculates the differences between the true labels and the predicted labels. It returns the minimum and maximum differences, as well as the difference array.
- Single Prediction: def get_single_prediction() This function performs a single prediction by iteratively refining the prediction interval until it stabilizes.
- Batch Prediction: def get_prediction() This function performs predictions for a batch of input data by calling "get_single_prediction" for each input sample.
- Main Function: This section sets up argument parsing, loads the test data, performs predictions, and saves the results to a specified file.
TensorFlow (backend library)
Basic
- https://www.tensorflow.org/
- https://tensorflow.rstudio.com/
- R interface to Keras. I followed the instruction for the installation but got an error of illegal operand. The solution is to use an older version of tensorflow; see here. library(keras); install_keras(tensorflow = "1.5") (Ubuntu 16.04, Phenom(tm) II X6 1055T)
- https://rviews.rstudio.com/2018/04/03/r-and-tensorflow-presentations/, Slides
- https://hub.docker.com/r/andrie/tensorflowr/, https://hub.docker.com/r/rocker/ml/dockerfile (outdated)
- Deep Learning on Biowulf
- Raspberry Pi
- Books
- Deep Learning with R by François Chollet with J. J. Allaire, 2018. ISBN-10: 161729554X (available on safaribooksonline)
- Deep Learning with Python by François Chollet, 2017 (available on safaribooksonline)
- Deep Learning by Ian Goodfellow and Yoshua Bengio and Aaron Courville
- Enterprise Web Services with Neural Networks Using R and TensorFlow A docker image was created based on R 3.5.0 using R libraries from MRAN’s July 2nd, 2018 snapshot, as well as Miniconda 3 version 4.4.10 for python.
- Deep Learning Glossary
- http://www.wildml.com/deep-learning-glossary/
- What is an epoch (related to batch) in deep learning?, Epoch vs Iteration when training neural networks. Example: if you have 1000 training examples, and your batch size is 500, then it will take 2 iterations to complete 1 epoch. Since "batch" depends on the partition of the entire samples, we need different partitions (epoches) in order to get an unbiased result.
- Best Books to learn Tensorflow
Some terms
Machine Learning Glossary from developers.google.com
Tensor
Tensors for Neural Networks, Clearly Explained!!!
Dense layer and dropout layer
In Keras, what is a "dense" and a "dropout" layer?
Fully-connected layer (= dense layer). You can choose "relu" or "sigmoid" or "softmax" activation function.
Activation function
- Artificial neural network -> Neural networks as functions [math]\displaystyle{ \textstyle f (x) = K \left(\sum_i w_i g_i(x)\right) }[/math] where K (commonly referred to as the activation function) is some predefined function, such as the hyperbolic tangent or sigmoid function or softmax function or rectifier function.
- Rectifier/ReLU f(x) = max(0, x).
- Sigmoid. Binary problem. Logistic function and hyperbolic tangent tanh(x) are two examples of sigmoid functions.
- Softmax. Multiclass classification.
Backpropagation
https://en.wikipedia.org/wiki/Backpropagation
Convolutional network
https://en.wikipedia.org/wiki/Convolutional_neural_network
Deep Learning with Python
Jupyter notebooks for the code samples of the book "Deep Learning with Python"
sudo apt install python3-pip python3-dev sudo apt install build-essential cmake git unzip \ pkg-config libopenblas-dev liblapack-dev sudo apt-get install python3-numpy python3-scipy python3-matplotlib \ python3-yaml sudo apt install libhdf5-serial-dev python3-h5py sudo apt install graphviz sudo pip3 install pydot-ng # sudo apt-get install python-opencv # https://stackoverflow.com/questions/37188623/ubuntu-how-to-install-opencv-for-python3 # https://askubuntu.com/questions/783956/how-to-install-opencv-3-1-for-python-3-5-on-ubuntu-16-04-lts sudo pip3 install keras
Colorize black-and-white photos
Colorize black-and-white photos
Keras using R
- R Markdown Notebooks for "Deep Learning with R"
- R interface to Keras
- Deep Neural Network in R
- Python vs R
- Derivative of a tensor operation: the gradient
- Define loss_value = f(W) = dot(W, x)
- W1 = W0 - step * gradient(f)(W0)
- Stochastic gradient descent
- Tensor operations:
- relu(x) = max(0, x)
- Each neural layer from our first network example transforms its input data:output = relu(dot(W, input) + b) where W and b are the weights or trainable parameters of the layer.
Training process:
- Draw a batch of X and Y
- Run the network on x (a step called the forward pass) to obtain predictions y_pred.
- How many layers to use.
- How many “hidden units” to chose for each layer.
- Compute the loss of the network on the batch
- loss
- optimizer: determines how learning proceeds (how the network will be updated based on the loss function). It implements a specific variant of stochastic gradient descent (SGD).
- metrics
- Update all weights of the network in a way that slightly reduces the loss on this batch.
- batch_size
- epochs (=iteration over all samples in a batch_size of samples)
Keras (in order to use Keras, you need to install TensorFlow or CNTK or Theano):
- Define your training data: input tensors and target tensors.
- Define a network of layers (or model). Two ways to define a model:
- using the keras_model_sequential() function (only for linear stacks of layers, which is the most common network architecture by far) or
model <- keras_model_sequential() %>% layer_dense(units = 32, input_shape = c(784)) %>% layer_dense(units = 10, activation = "softmax")
- the functional API (for directed acyclic graphs of layers, which let you build completely arbitrary architectures)
input_tensor <- layer_input(shape = c(784)) output_tensor <- input_tensor %>% layer_dense(units = 32, activation = "relu") %>% layer_dense(units = 10, activation = "softmax") model <- keras_model(inputs = input_tensor, outputs = output_tensor)
- using the keras_model_sequential() function (only for linear stacks of layers, which is the most common network architecture by far) or
- Compile the learning process by choosing a loss function, an optimizer, and some metrics to monitor.
model %>% compile( optimizer = optimizer_rmsprop(lr = 0.0001), loss = "mse", metrics = c("accuracy") )
- Iterate on your training data by calling the fit() method of your model.
model %>% fit(input_tensor, target_tensor, batch_size = 128, epochs = 10)
Custom loss function
Custom Loss functions for Deep Learning: Predicting Home Values with Keras for R
Metrics
https://machinelearningmastery.com/custom-metrics-deep-learning-keras-python/
Docker RStudio IDE
Assume we are using rocker/rstudio IDE, we need to install some packages first in the OS.
$ docker run -d -p 8787:8787 -e USER=XXX -e PASSWORD=XXX --name rstudio rocker/rstudio $ docker exec -it rstudio bash # apt update # apt install python-pip python-dev # pip install virtualenv
And then in R,
install.packages("keras") library(keras) install_keras(tensorflow = "1.5")
Use your own Dockerfile
Data Science for Startups: Containers Building reproducible setups for machine learning
Some examples
See Tensorflow for R from RStudio for several examples.
Binary data (Chapter 3.4)
- The final layer will use a sigmoid activation so as to output a probability (a score between 0 and 1, indicating how likely the sample is to have the target “1”.
- A relu (rectified linear unit) is a function meant to zero-out negative values, while a sigmoid “squashes” arbitrary values into the [0, 1] interval, thus outputting something that can be interpreted as a probability.
library(keras) imdb <- dataset_imdb(num_words = 10000) c(c(train_data, train_labels), c(test_data, test_labels)) %<-% imdb # Preparing the data vectorize_sequences <- function(sequences, dimension = 10000) {...} x_train <- vectorize_sequences(train_data) x_test <- vectorize_sequences(test_data) y_train <- as.numeric(train_labels) y_test <- as.numeric(test_labels) # Build the network ## Two intermediate layers with 16 hidden units each ## The final layer will output the scalar prediction model <- keras_model_sequential() %>% layer_dense(units = 16, activation = "relu", input_shape = c(10000)) %>% layer_dense(units = 16, activation = "relu") %>% layer_dense(units = 1, activation = "sigmoid") model %>% compile( optimizer = "rmsprop", loss = "binary_crossentropy", metrics = c("accuracy") ) model %>% fit(x_train, y_train, epochs = 4, batch_size = 512) ## Error in py_call_impl(callable, dots$args, dots$keywords) : MemoryError: ## 10.3GB memory is necessary on my 16GB machine # Validation results <- model %>% evaluate(x_test, y_test) # Prediction on new data model %>% predict(x_test[1:10,])
Multi class data (Chapter 3.5)
- Goal: build a network to classify Reuters newswires into 46 different mutually-exclusive topics.
- You end the network with a dense layer of size 46. This means for each input sample, the network will output a 46-dimensional vector. Each entry in this vector (each dimension) will encode a different output class.
- The last layer uses a softmax activation. You saw this pattern in the MNIST example. It means the network will output a probability distribution over the 46 different output classes: that is, for every input sample, the network will produce a 46-dimensional output vector, where outputi is the probability that the sample belongs to class i. The 46 scores will sum to 1.
library(keras) reuters <- dataset_reuters(num_words = 10000) c(c(train_data, train_labels), c(test_data, test_labels)) %<-% reuters model <- keras_model_sequential() %>% layer_dense(units = 64, activation = "relu", input_shape = c(10000)) %>% layer_dense(units = 64, activation = "relu") %>% layer_dense(units = 46, activation = "softmax") model %>% compile( optimizer = "rmsprop", loss = "categorical_crossentropy", metrics = c("accuracy") ) history <- model %>% fit( partial_x_train, partial_y_train, epochs = 9, batch_size = 512, validation_data = list(x_val, y_val) ) results <- model %>% evaluate(x_test, one_hot_test_labels) # Prediction on new data predictions <- model %>% predict(x_test)
- MNIST dataset.
Regression data (Chapter 3.6)
- Because so few samples are available, we will be using a very small network with two hidden layers. In general, the less training data you have, the worse overfitting will be, and using a small network is one way to mitigate overfitting.
- Our network ends with a single unit, and no activation (i.e. it will be linear layer). This is a typical setup for scalar regression (i.e. regression where we are trying to predict a single continuous value). Applying an activation function would constrain the range that the output can take. Here, because the last layer is purely linear, the network is free to learn to predict values in any range.
- We are also monitoring a new metric during training: mae. This stands for Mean Absolute Error.
library(keras) dataset <- dataset_boston_housing() c(c(train_data, train_targets), c(test_data, test_targets)) %<-% dataset build_model <- function() { model <- keras_model_sequential() %>% layer_dense(units = 64, activation = "relu", input_shape = dim(train_data)[[2]]) %>% layer_dense(units = 64, activation = "relu") %>% layer_dense(units = 1) model %>% compile( optimizer = "rmsprop", loss = "mse", metrics = c("mae") ) } # K-fold CV k <- 4 indices <- sample(1:nrow(train_data)) folds <- cut(1:length(indices), breaks = k, labels = FALSE) num_epochs <- 100 all_scores <- c() for (i in 1:k) { cat("processing fold #", i, "\n") # Prepare the validation data: data from partition # k val_indices <- which(folds == i, arr.ind = TRUE) val_data <- train_data[val_indices,] val_targets <- train_targets[val_indices] # Prepare the training data: data from all other partitions partial_train_data <- train_data[-val_indices,] partial_train_targets <- train_targets[-val_indices] # Build the Keras model (already compiled) model <- build_model() # Train the model (in silent mode, verbose=0) model %>% fit(partial_train_data, partial_train_targets, epochs = num_epochs, batch_size = 1, verbose = 0) # Evaluate the model on the validation data results <- model %>% evaluate(val_data, val_targets, verbose = 0) all_scores <- c(all_scores, results$mean_absolute_error) }
PyTorch
An R Shiny app to recognize flower species
Google Cloud Platform
- Choosing between TensorFlow/Keras, BigQuery ML, and AutoML Natural Language for text classification Comparing text classification done three ways on Google Cloud Platform
Amazon
Amazon's Machine Learning University is making its online courses available to the public
Workshops
Notebooks from the Practical AI Workshop 2019
OpenML.org
Biology
- Predicting Splicing from Primary Sequence with Deep Learning Jaganathan et al 2018
- Intelligent diagnosis with Chinese electronic medical records based on convolutional neural networks Li et al BMC Bioinformatics 2019
- DL 101: Basic introduction to deep learning with its application in biomedical related fields 2022