Unit 1 / 11

Introduction to Artificial Intelligence in Data Science and Analytics: Workflow, Roles, Boundaries, Validation and Ethics

Gains:

  • Ability to distinguish the six-stage workflow of data science (problem definition, collection, cleaning, discovery, modeling, communication) and the authority under which artificial intelligence works at each stage, according to the task risk level
  • Ability to apply a discipline that verifies each artificial intelligence output by connecting it to the source, running and comparing it, and passing it through expert filtering.
  • Ability to turn reproducibility and privacy principles (writing into code, anonymization) into analysis habits from day one

Raw, messy, and often “lying” data lands on a data scientist's desk every day. In the sales table, the date column is written in three different formats; customer numbers are blank in some lines; The name of a column is "income", but it contains both TL and USD values. The job of data science is to make a reliable decision out of this chaos: collect the data, clean it, explore it, build a model, validate the result, and turn it into a story. Artificial intelligence (AI, or AI for short—computer systems that can generate text and code, recognize patterns, summarize, and make predictions) can touch every link in this chain: writing cleanup code in minutes, recommending graphs for exploratory analysis, interpreting a model's metric, correcting an SQL query. But the same AI can also give you a confident fabrication such as "correlation 0.72" for data it has never seen.

This first unit is not a library introduction. Its purpose is to clarify where to put AI in the data science workflow and where never to put it. Let's lay out the basic principle from the beginning: AI is an assistant, not a data scientist. The decision of what data to collect, what metric to decide on, whether to put a model into production, and where to draw ethical boundaries rests with the competent expert. An unverified AI output is risky, as is an unsigned analysis report.

Data science workflow: end-to-end map

To understand a data project, it's helpful to break it down into six phases. This entire module follows this map.

1. Problem definition: What do we measure, why, to support which decision? This phase is not delegated to the AI; It is the person who defines the job.

2. Data collection: Identifying sources, extracting data, sampling. (Unit 2)

3. Data cleaning and preprocessing: Missing value, outlier, type conversion. (Unit 3)

4. Exploratory data analysis (EDA - Exploratory Data Analysis, the stage of recognizing the distribution and relationships of the data "by eye"): (Unit 4)

5. Feature engineering and modeling: Variable generation, algorithm selection, training, evaluation. (Unit 5, 6, 7)

6. Communication and production: Visualization, story, MLOps (discipline of taking the model live and monitoring it). (Unit 8, 11)

AI operates with a different authority in each of these six stages. The table below summarizes this distribution of authority; This is the single most important table of the module.

Stage

Role of AI

Risk level

Who approves

Problem definition

brainstorming partner

low

Data scientist + stakeholder

Write a cleanup code

Code sketch generator

medium

Data scientist (reads code)

EDA comment

pattern suggestor

medium

data scientist

Feature generation

Idea and code generator

medium-high

Leak control is a must

Model selection/metric

consultant

high

data scientist

Decision to put into production

auxiliary input

very high

Team + business owner

Ethics/privacy approval

stimulant

very high

human, always

Keep in mind the one sentence from this chart: as the stakes rise, the AI's role shrinks and human approval grows.

Why verification is the heart of this business

AI language models look sure, but they may not be sure. In technical language, this is called hallucination: it is the model's fabrication of non-existent information in a fluent sentence as if it were true. In data science, this comes in three forms. The first is a fake number: if you ask the model "what is the average order amount" without giving any data, it will confidently tell you a number, even though it has never seen your data. The second is a function that does not exist: the model may suggest a function that does not exist at all, such as pandas.read_excel_fast(). Third, incorrect statistical interpretation: the model can smoothly repeat a classic statistical error such as “p-value is 0.04, so the hypothesis is 96% correct”.

The verification discipline consists of three steps:

  1. Link to source: Every number, rate, and trend should come from your data, not the AI's memory. Use AI for code that operates on data, not for it to remember data.
  2. Run and compare: Run each piece of code given by the AI ​​yourself; Compare each metric it produces to an independent baseline.
  3. Expert filter: Test for yourself whether the output contradicts statistics and domain knowledge.
Caution: Putting an analysis written by the AI ​​into a presentation without running and reading it is like presenting an unsigned report. Just because the code works doesn't mean it's correct; A code that sums the wrong column also works without errors.

Reproducibility: being able to produce the same result twice

The silent but critical principle of data science is reproducibility: when you run an analysis again six months later or on a different computer, you get the same result. This risk increases when working with AI, because when you tell the AI ​​to "make this graph" and play it manually, the steps disappear. Rule: every step must be registered in the code and version control (like Git); In steps involving randomness, the random seed (the initial value of the random number generator; if fixed, the result will be repeatable) should be fixed. We will deepen this topic in Unit 10; For now, get into this habit: "Don't click by hand, write in code."

three mini cases

Case 1 — Safe acceleration. An e-commerce analyst would normally spend half a day clearing an order table of 240 thousand rows. He gave the column names and the first 5 rows (without personal data) to the AI ​​and asked for the pandas cleaning code. AI produced draft in 8 seconds; The analyst read the code line by line, fixed an error in date parsing, and ran it. Duration: 35 minutes instead of 4 hours. AI provided code, verification remained with the human.

Case 2 — The made-up metric trap. An intern asked the AI, "How accurate is random forest on this data?" without training the model at all. “About 89%,” AI said. The intern put this into the presentation; When the real model was trained, the accuracy was 71%. Mistake: Waiting for metrics without giving data and models to AI.

Case 3 — Silent leak. One team implemented the AI-suggested idea of ​​“add the mean of the target variable as a feature” without questioning it. The model performed 98% on the test set but crashed in production because the feature was leaking future information (data leak, Unit 10). Mistake: Not statistically filtering the AI ​​recommendation.

Weak prompt / Strong prompt

Weak prompt:

Analyze this sales data and tell me the average revenue.

This claim is flawed: the AI ​​was not given data, so the “average income” can only be made up. Neither the columns, nor the period, nor the currency are clear.

Powerful prompt:

Your role: assistant helping a data scientist. I have a pandas DataFrame: df. Columns:- order_date (text, in format "2024-03-01")- amount_tl (decimal, NaN in some rows)- customer_id (integer)Task: (1) write pandas code that calculates the average amount,(2) explain how it handles NaN values,(3) list the assumptions the code makes. Don't make up the data content; just generate code and I will run and verify the result.

In this request, the scheme, the expectation and the "prohibition of fabrication" are clear. You still run and verify the output yourself.

The beginnings of ethics and privacy

Data science often works with personal data: customer, patient, employee records. KVKK (Personal Data Protection Law) in Türkiye and GDPR in Europe protect this data. Pasting your real name, ID, email or address into a public AI tool is a violation. Rule: anonymize data before sharing, only provide schema (column names, types) and dummy example row if necessary. We will deepen the topic of ethics in Unit 11; Let's put the principle from the beginning: To understand the data, sharing its structure, not its content, is often enough.

Common mistakes

  • Waiting for numbers/metrics without giving data to the AI. The model cannot access the data; The number he gives is fake. Always have the result calculated and run.
  • Thinking that the working code is correct. The code that manipulates the wrong column also runs without errors; Do not trust without reading the logic.
  • Pasting real personal data into the open tool. Name, ID number, e-mail are never shared; The diagram is enough.
  • Doing the steps manually and not writing them into the code. Analysis that is not reproducible is unreliable.
  • Accepting AI's interpretation of statistics without question. AI can repeat classic mistakes in concepts such as p-value and correlation.
Tip: Include a short "rule line" in each of your AI sessions: "Don't make up the data content; just generate code/analysis and I'll run and verify the result; indicate 'not sure' where you're unsure." This single sentence significantly reduces the risk of hallucinations.

In summary

AI is a powerful assistant in data science: it accelerates cleaning code, EDA interpretation, model recommendation and visualisation. But problem definition, metric selection, production decision and ethical boundaries belong to humans. The workflow has six stages, and the AI's role becomes smaller as the risk increases. Three habits are the foundation of everything: source linking (validation), reproducibility (coding), and anonymization (confidentiality). Once you internalize these three, every tool in the rest of the module becomes a safe accelerator for you.

Application task

Just make a schema of a small table you have (or a hypothetical one): column names, types, and 2-3 dummy example rows (without real personal data). Ask the AI ​​for a summary stats code using the "Powerful prompt" template above. Run the code, compare the output to a manual value, check for any spurious assumptions, and note your findings in 5 bullet points.

checklist

  • [ ] Did I just give the AI ​​a schema and a fake sample instead of real personal data?
  • [ ] Did I read and run the code it produced line by line?
  • [ ] Have I independently verified each number in the output?
  • [ ] Have I written every step of the analysis into the code and made it repeatable?
  • [ ] Have I determined the risk level of the mission and assigned the final decision to a human?