投稿時間:2023-08-26 17:08:02 RSSフィード2023-08-26 17:00 分まとめ(10件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 「iPhone 15」シリーズのカラーラインナップのモデル名とカラーコードが明らかに?? https://taisy0.com/2023/08/26/175861.html iphone 2023-08-26 07:45:34
TECH Techable(テッカブル) 組織力向上プラットフォーム「Wevox」、AIに“組織づくりに関する相談”ができる新機能追加 https://techable.jp/archives/218062 wevot 2023-08-26 07:00:51
Google カグア!Google Analytics 活用塾:事例や使い方 【悲報】PayPal Meのユーザー名は変更できない https://www.kagua.biz/social/monetization/20230826a1.html paypalme 2023-08-26 07:09:43
python Pythonタグが付けられた新着投稿 - Qiita geopandasを使ってみて迷ったこと https://qiita.com/tonytani37/items/f67f7130293479f8a992 geopand 2023-08-26 16:02:32
AWS AWSタグが付けられた新着投稿 - Qiita 【AWS】EC2 AMI/ALB/Auto Scalingの備忘録 https://qiita.com/grapefruit1030/items/a358df72de65896aada5 amiamazonmachineimage 2023-08-26 16:54:13
海外TECH DEV Community SRP: Refactoring the Data Science Beyond Classes https://dev.to/proteusiq/srp-refactoring-the-data-science-beyond-classes-5ake SRP Refactoring the Data Science Beyond ClassesPicture a grand symphony orchestra woodwinds brass strings and percussion each section distinct yet harmoniously united The conductor waves the baton and every instrument plays its part contributing to a cohesive magnificent whole This musical harmony the flawless interplay of instruments is what the SOLID Principles seek to instil in our data science canvas with the Single Responsibility Principle SRP as instruments Woohoo You re still here You re thirsty for more Not only have you journeyed this far but you ve also conquered Building the Bedrock Employing SOLID Principles in Data Science I am here Now with that fire in our belly we re all geared up to explorer how SRP can revolutionize Data Science code base The S in SOLID The Maestros Behind the CurtainSRP isn t just a software design principle It s an art form a meticulous choreography of roles and responsibilities Beyond the confines of classes SRP sings a computer science symphony ensuring every instrument be it a function a class or a file resonates with its unique note yet contributes to the collective melody of the project If a file a function or a class has more than one responsibility it becomes coupled A change to one responsibility often results to modification of the other responsibility It becomes not only difficult to maintain but also unreliable Give that the ultimate goal is to produce software that is not only robust and reliable but also easy to maintain SRP becomes the heart and soul our software design principle When each part of the software focuses on one primary responsibility it becomes less tangled and therefore easier to understand and modify Let s Code Creating Data Preprocessing PipelineIn a bustling orchestra hall imagine a Jupyter notebook resonating with Pythonic Pandas compositions data transformations flowing like a symphony doing pipeline data transformation creating a harmonious tune But as the concert progresses the melodies intertwine becoming complex and hard to follow Enter the SRP Like a masterful composer we rearrange the musical pieces refactoring our notebook s intricate sections into separate scores Each score now holds its unique melody making the entire composition more resilient to change and a breeze to perform Our once tangled symphony is now a harmonious ballet of data harmonies each with its own spotlight Task Prototype Each Task has to implement run method file prototypes pyfrom abc import ABC abstractmethodclass Task ABC property def name self gt str return self class name abstractmethod def run self args kwargs passNow the instruments that do one thing well Tasks that can be divided into their own files from prototypes import Taskfrom typing import Literalimport numpy as npimport pandas as pdfrom sklearn compose import make column transformerfrom sklearn pipeline import make pipelinefrom sklearn preprocessing import FunctionTransformer OneHotEncoderfrom sklearn import set configfrom srp import configset config transform output pandas transformer make column transformer FunctionTransformer np log config COLUMNS TO LOG TRANSFORM OneHotEncoder sparse output False config COLUMNS TO ONEHOTENCODE verbose feature names out False remainder passthrough class DropZerosTask Task def run self data pd DataFrame gt pd DataFrame cleaned data data data select dtypes number eq any axis return cleaned dataclass DropColumnsTask Task def init self columns list str self columns columns def run self data pd DataFrame gt pd DataFrame cleaned data data drop columns self columns return cleaned data TODO decorator to save and load transformerclass TransformerTask Task def init self stage Literal train predict train self stage stage def run self data pd DataFrame gt pd DataFrame if self stage predict cleaned data transformer transform data else cleaned data transformer fit transform data return cleaned dataclass FloatsIntsTask Task def init self columns list str self columns columns def run self data pd DataFrame gt pd DataFrame cleaned data data cleaned data self columns cleaned data self columns transform pd to numeric errors coerce downcast integer return cleaned dataThis modular approach offers flexibility As needs and technologies change it s much simpler to adjust or replace individual parts rather than overhaul the entire system Time to note the conductor responsible for adding and calling instruments DataTasks gather and runner file data datatasks py from prototypes import Taskfrom future import annotationsfrom queue import PriorityQueueimport pandas as pdfrom loguru import loggerclass DataTasks def init self tasks PriorityQueue None gt DataTasks if tasks is None self tasks PriorityQueue def set task self priority int task Task gt DataTasks self tasks put priority task return self def run self data pd DataFrame gt pd DataFrame while not self tasks empty task self tasks get logger debug f priority task task name data task run data return dataSince Tasks need only to implement the run method that returns a DataFrame this part of the software does not change with changes in Tasks Thus crafting a piece that is both adaptable to future changes and resilient in its operation Finally a grand symphony A seamless pipeline that is robust maintainable and adaptable to change Implementation from data datatasks import DataTasks from data tasks import from srp import configdef process data data pd DataFrame gt pd DataFrame data chain DataTasks data chain set task priority task DropZerosTask set task priority task DropColumnsTask columns config COLUMNS TO DROP set task priority task TransformerTask set task priority task FloatsIntsTask columns config COLUMNS TO FLOATS TO INTEGER Add more or remove tasks to the chain as needed Send data through the chain return data chain run data in the main import process dataif name main import pandas as pd URI dataf pd read csv URI clean data process data dataf The Guiding Stars Avoiding the Black HolesWhile SRP and design patterns offer a universe of possibilities beware of the black holes of over engineering and complexity Not every problem demands this symphony sometimes a simple melody will do We still need to tailor our approach to the narrative of our project The SRP began to transform our data science projects into masterpieces cohesive yet complex simple yet sophisticated Every component like a perfectly tuned instrument plays its part contributing to the entire symphony and ensuring our projects are maintainable scalable and extensible The cosmic masterpieces journey does not end here It has just started Our next SOLID guiding star is O The Open Closed Principle OCP OCP guides us to build units that are open for extension but closed for modification A saga for the next article in this series Up Next OCP Refactoring the Data Science Project Until then keep on coding data science SOLID ly const artist Shahnoza Bekbulaeva console log artist 2023-08-26 07:22:26
海外TECH DEV Community how to run multiple queries in .txt file on sql plus https://dev.to/realnamehidden1_61/how-to-run-multiple-queries-in-txt-file-on-sql-plus-1e8l how to run multiple queries in txt file on sql plusstep create file with txt extensionstep write the sql queries that you want to execute inside the txt filestep copy the location of the filestep run the file as belowfor example i have created the file script txtnow for running thisoutput if you are not getting the queries that are executed then run the command 2023-08-26 07:15:07
海外TECH CodeProject Latest Articles Use Case Driven Development with Low-Code https://www.codeproject.com/Articles/5367233/Use-Case-Driven-Development-with-Low-Code codeuse 2023-08-26 07:17:00
ニュース BBC News - Home Spain FA accuses player Hermoso of lying about World Cup kiss https://www.bbc.co.uk/sport/football/66626410?at_medium=RSS&at_campaign=KARANGA rubiales 2023-08-26 07:47:38
ニュース BBC News - Home British Museum recovers some of 2,000 stolen items https://www.bbc.co.uk/news/entertainment-arts-66626619?at_medium=RSS&at_campaign=KARANGA reputation 2023-08-26 07:47:06

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)