{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"**What has it been learnt in the past two years about Ethics?**\n\nEthics can change from ephoc to ephoc in every country. However, globalization in the last decades shares some basic principles  about what is good or bad in many cultures. This principles help to create rules about what is allowed when using AI. It's not easy to create these rules, it could contain some legal loopholes that can affect in a permanent way life's people, differents authors have discussed this kind of topics as we explain follow:\n\nSome organizations have published mandatory rules about ethics for AI, as [Diaz-Rodriguez et al] explain. Responsability is one of the common requirement as AI can help or harm people, it is necessary than people and organizations legally respond to control what their AI do, also, the best of current AI are not clearly considered as strong AI or super AI, so humans still have an important role to take decisions. On the other hand, fairness is necessary in AI, fairness can be affected not only by algorithm design but also by biased data.  Transparency is another requiremente for AI, some efforts have been done to explain how AI work, however, explanation of large and combined algorithms \"is beyond the comprehension of human intelligence\" as [Zhang and Zhang] explain. Privacy, human-centered, sustainability, prevention of harm are another topics to dicuss about laws for AI ethics. Finally, as [Wang et al] pointed out, \"while external regulations such as ethical guidelines are important, research suggests that they may be insufficient in influencing individuals’ ethical decision-making\"\n\nGeneral population are interested in befenits of using AI while some of them ignore ethical analysis about it. Some examples of bad ethical use of AI are given in education where students can plagiarize and cheat, use bias or fake news as source of information, develope a lazy attitude and eventually reduce critical thinking [Tlili et al]. All of them can affect how young people contribute to the future, however, it is noticed that some educational institutions have no change significantly their teach-learning methodology the last decades, AI will have a key role in the five industrial revolution, also, it is expected AI changes paradigms in education, moreover,  it is expected that people eventually reach readiness of using AI in their daily activities and understand ethical implications of using AI. About healthcare system, data is necessary to train models, while privacy is mandatory and patient should give consent for using their personal data, it could happpen that patient don't realize specific implications for provide their data. De-identification and anonymization are used to protect patient's privacy, however, there are studies like [Dehkharghanian et al] which explain how trained medical AI give data that can be used to identify which institution take a sample although it is known it could affect privacy and bias models.\n\n\nFinally, organizations start to include ethics in their projects with embebed ethics, it is achieved by including ethicists and social scientists in every stage of the project.  [Tigard et al] evaluated performance of the interdisciplinary teams and found some recomendations: facilitate discussion about specific topics instead generic presentations, cultural adaptations not only for engineers but also for ethicist, ensure privacy of expressed thoughts, among others. Ethic have achieved an important role in projects so a trend called \"ethic washing\" can be found in some cases, ethic washing highlight efforts about ethics in advertising but no real work neither ethic's based conclusion are found in these kind of projects.\n\nAs a conclusion, people start to realize ethics implications about use of AI while designers are working together ethicist to develope ethical application of AI not only for fulfill especific laws but also for develope tools that really aid to humanity. Universal human values helps working team to share common points of view about practical application of ethics in their projects.\n\nReferences:\n\n    [1] N. Díaz-Rodríguez, J. D. Ser, M. Coeckelbergh, M. L. de Prado, E. Herrera-Viedma, and F. Herrera, “Connecting the dots in trustworthy Artificial Intelligence: From AI principles, ethics, and key requirements to responsible AI systems and regulation,” Information Fusion, p. 101896, 2023, doi: https://doi.org/10.1016/j.inffus.2023.101896.\n    [2] J. Zhang and Z.-m. Zhang, “Ethics and governance of trustworthy medical artificial intelligence,” BMC Medical Informatics and Decision Making, vol. 23, no. 1, 2023, doi: 10.1186/s12911-023-02103-9.\n    [3] X. Wang, L. Li, S. C. Tan, L. Yang, and J. Lei, “Preparing for AI-enhanced education: Conceptualizing and empirically examining teachers’ AI readiness,” Computers in Human Behavior, vol. 146, 2023, doi: 10.1016/j.chb.2023.107798.\n    [4] A. Tlili et al., “What if the devil is my guardian angel: ChatGPT as a case study of using chatbots in education,” Smart Learning Environments, vol. 10, no. 1, 2023, doi: 10.1186/s40561-023-00237-x.\n    [5] T. Dehkharghanian et al., “Biased data, biased AI: deep networks predict the acquisition site of TCGA images,” Diagnostic Pathology, vol. 18, no. 1, 2023, doi: 10.1186/s13000-023-01355-3.\n    [6] D. W. Tigard et al., “Toward best practices in embedded ethics: Suggestions for interdisciplinary technology development,” Robotics and Autonomous Systems, vol. 167, 2023, doi: 10.1016/j.robot.2023.104467.\n\n","metadata":{}},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n#my personal imports....needed for graphs\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import ListedColormap\nimport math\nimport json\nimport time\n\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-07-04T21:18:16.250776Z","iopub.execute_input":"2023-07-04T21:18:16.251284Z","iopub.status.idle":"2023-07-04T21:18:16.267610Z","shell.execute_reply.started":"2023-07-04T21:18:16.251246Z","shell.execute_reply":"2023-07-04T21:18:16.266270Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def reordena(didi, veve):\n    newdi=[]\n    veord=sorted(veve,reverse=True)\n    lasin=0#anterior indice\n    lasit=-1#anterior iterador\n    for it in veord:\n        #print(lasit!=it, end=\" \")\n        if lasit!=it:\n            lasin=0\n            lasin=veve.index(it,lasin)\n        else:\n            lasin=veve.index(it,lasin+1)\n        lasit=it\n        \n        newdi.append(didi[lasin])\n    return newdi,veord    \ndef printfirst(didi,veve,canti):\n    for ind,val in enumerate(didi):\n        print(val,\" \",veve[ind])\n        if ind==canti-1:\n            break;\n\n#every =pd.read_json(\"/kaggle/input/2023-kaggle-ai-report/arxiv_metadata_20230510.json\", lines=True)\n#df=every\ndf =pd.read_csv(\"/kaggle/input/scopusdbethics/scopus_ethics.csv\")\nmydi = []\nmyve = []#mi vector de veces\nmydidi = []#vectores especiales para la combinación de pares de palabras\nmyveve=[]\nseparado=[]\nkeywords=[\"ethics\",\"regulation\",\"fair\",\"fairness\"]\nnewdf=None\n#type(newdf)==type(None)\nconta=0\ntinicial=time.time()\ntlimite=60*5#segundos\nconteo = np.zeros(df.shape[0],dtype=bool)\ntitulos=df[\"Title\"].values.tolist()\n#print(type(titulos[0]))\nfor tit in titulos:\n    conta+=1\n    if conta%100==0:\n        #print(conta, time.time()-tinicial)\n        continue\n    tit = tit.lower().replace(\"\\n\",\"\").replace(\",\",\"\").replace(\"(\",\"\").replace(\"?\",\"\")\n    tit= tit.replace(\"¿\",\"\").replace(\")\",\"\").replace(\"[\",\"\").replace(\"]\",\"\").replace(\":\",\"\").replace(\".\",\"\")\n    tit=tit.replace(\"and\",\"\").replace(\"the \",\" \").replace(\"for \",\" \").replace(\"with \",\" \").\\\n        replace(\"from\",\"\").replace(\"study \",\" \").replace(\"use \",\" \").replace(\"using \",\" \").\\\n        replace(\"how\",\"\").replace(\"can\",\"\").replace(\"through\",\"\").replace(\"what\",\"\").\\\n        replace(\"new\",\"\").replace(\"between\",\"\").replace(\"into\",\"\").replace(\"ethical\",\"ethics\").\\\n        replace(\"artificial\",\"\").replace(\"intelligence\",\"\")\n    tit= tit.replace(\"    \",\" \").replace(\"   \",\" \").replace(\"  \",\" \")\n    words = list(set(tit.split(\" \")))#se separan las palabras y se ignoran ciertos caractereres\n    tempdi = []\n    tempve = []\n    indx=0\n    for wo in words:\n        if len(wo)>2:#si la palabra tiene más de 4 letras\n            tempdi.append(wo)\n    for wo in tempdi:\n        if wo not in mydi:\n            mydi.append(wo),myve.append(1)#agrege la palabra al vector\n        else:\n            ind=mydi.index(wo)\n            myve[ind]+=1#hay un sancocho de asignaciones\n    conj=[]\n    for it in tempdi:\n        for it2 in tempdi:\n            if not (it is it2):\n                if it[0]!=it2[0]:\n                    conj.append(it+\"-\"+it2 if ord(it[0])<ord(it2[0]) else it2+\"-\"+it) # se conjugan las palabras de cada titulo y se guardaran en un \n                else:\n                    conj.append(it+\"-\"+it2 if ord(it[1])<ord(it2[1]) else it2+\"-\"+it)\n                #vector de conjugación, de igual forma se contarán las veces repetidas#se comienza por la palabra con menor letra.....\n    conj=list(set(conj))\n      \n    for it in conj:\n        if it not in mydidi:\n             mydidi.append(it),  myveve.append(1)\n        else:\n            ind=mydidi.index(it)\n            myveve[ind]+=1\n#print(time.time()-tinicial)\nconjre,conjve=reordena(mydidi,myveve)\n#printfirst(conjre, conjve,1000)\nreord,reve =  reordena(mydi,myve)\nimport networkx as nx\nimport matplotlib.pyplot as plt\n\n\nngrafo=nx.Graph()\ncolor_map = []\n\nfor ind,conj in enumerate(conjre[0:100]):\n    wos=conj.split(\"-\")\n    if True or (wos[0]!=\"ethics\" and wos[1]!=\"ethics\"):\n        ngrafo.add_node(wos[0])\n        ngrafo.add_node(wos[1])\n        ngrafo.add_edge(wos[0],wos[1])\n        \n\nfor nod in ngrafo:\n    try:\n        val=myve[mydi.index(nod)]\n    except:\n        val=30\n    if val<20:\n        color_map.append('blue')\n    else:\n        color_map.append('red')  \n        \n# Dibuja el grafo\nplt.figure(1,figsize=(10,10))\npos = nx.spring_layout(ngrafo, k=0.1, iterations=10)\n# k controls the distance between the nodes and varies between 0 and 1\n# iterations is the number of times simulated annealing is run\n# default k=0.1 and iterations=50\nnx.draw_networkx(ngrafo,pos,  with_labels=True, node_color=color_map, node_size=100, font_size=8, font_color='black', edge_color='gray')\n#'lightblue'\n# Muestra el gráfico\nplt.show()\nplt.savefig(\"terms.png\")","metadata":{"execution":{"iopub.status.busy":"2023-07-04T21:18:16.270304Z","iopub.execute_input":"2023-07-04T21:18:16.270806Z","iopub.status.idle":"2023-07-04T21:18:41.864799Z","shell.execute_reply.started":"2023-07-04T21:18:16.270759Z","shell.execute_reply":"2023-07-04T21:18:41.863578Z"},"trusted":true},"execution_count":null,"outputs":[]}]}