Prediksi tingkat lanjut Software Statistik (R atau...
创建于:2026年6月7日
使用 GPT-5.5 Thinking 回答 Chat01
创建于:2026年6月7日
使用 GPT-5.5 Thinking 回答 Chat01
Prediksi tingkat lanjut Software Statistik (R atau SPSS) cari hasil selanjutnya
pythonfrom pathlib import Path path=Path('/mnt/data/PRIZE.txt') text=path.read_text(encoding='utf-8', errors='replace') len(text), text[:1000], text[-1000:] (97663, '=== HASIL EKSTRAKSI DATA PRIZE ===\n\nTanggal: 10 Februari 2026 | Waktu: 21:30\n6112 0, 3, 4, 5, 7, 8, 9\n0236 1, 4, 5, 7, 8, 9\n7341 0, 2, 5, 6, 8, 9\n------------------------------\nTanggal: 11 Februari 2026 | Waktu: 03:30\n9876 0, 1, 2, 3, 4, 5\n2992 0, 1, 3, 4, 5, 6, 7, 8\n1685 0, 2, 3, 4, 7, 9\n------------------------------\nTanggal: 11 Februari 2026 | Waktu: 06:30\n2279 0, 1, 3, 4, 5, 6, 8\n9443 0, 1, 2, 5, 6, 7, 8\n1208 3, 4, 5, 6, 7, 9\n------------------------------\nTanggal: 11 Februari 2026 | Waktu: 11:30\n7453 0, 1, 2, 6, 8, 9\n8459 0, 1, 2, 3, 6, 7\n9350 1, 2, 4, 6, 7, 8\n------------------------------\nTanggal: 11 Februari 2026 | Waktu: 13:30\n7814 0, 2, 3, 5, 6, 9\n6407 1, 2, 3, 5, 8, 9\n7690 1, 2, 3, 4, 5, 8\n------------------------------\nTanggal: 11 Februari 2026 | Waktu: 17:30\n1965 0, 2, 3, 4, 7, 8\n3041 2, 5, 6, 7, 8, 9\n1575 0, 2, 3, 4, 6, 8, 9\n------------------------------\nTanggal: 11 Februari 2026 | Waktu: 21:30\n0329 1, 4, 5, 6, 7, 8\n1406 2, 3, 5, 7, 8, 9\n7820 1, 3, 4', '\n6575 0, 1, 2, 3, 4, 8, 9\n------------------------------\nTanggal: 06 Juni 2026 | Waktu: 06:30\n1709 2, 3, 4, 5, 6, 8\n4932 0, 1, 5, 6, 7, 8\n8660 1, 2, 3, 4, 5, 7, 9\n------------------------------\nTanggal: 06 Juni 2026 | Waktu: 11:30\n4339 0, 1, 2, 5, 6, 7, 8\n4925 0, 1, 3, 6, 7, 8\n6097 1, 2, 3, 4, 5, 8\n------------------------------\nTanggal: 06 Juni 2026 | Waktu: 13:30\n2098 1, 3, 4, 5, 6, 7\n9726 0, 1, 3, 4, 5, 8\n1473 0, 2, 5, 6, 8, 9\n------------------------------\nTanggal: 06 Juni 2026 | Waktu: 17:30\n5663 0, 1, 2, 4, 7, 8, 9\n8650 1, 2, 3, 4, 7, 9\n9724 0, 1, 3, 5, 6, 8\n------------------------------\nTanggal: 06 Juni 2026 | Waktu: 21:30\n5113 0, 2, 4, 6, 7, 8, 9\n1359 0, 2, 4, 6, 7, 8\n8641 0, 2, 3, 5, 7, 9\n------------------------------\nTanggal: 07 Juni 2026 | Waktu: 03:30\n8304 1, 2, 5, 6, 7, 9\n4068 1, 2, 3, 5, 7, 9\n9668 0, 1, 2, 3, 4, 5, 7\n------------------------------\nTanggal: 07 Juni 2026 | Waktu: 06:30\n4278 0, 1, 3, 5, 6, 9\n4829 0, 1, 3, 5, 6, 7\n5370 1, 2, 4, 6, 8, 9')
pythonimport re, pandas as pd, numpy as np, math, statistics from datetime import datetime months = { 'Januari':1,'Februari':2,'Maret':3,'April':4,'Mei':5,'Juni':6,'Juli':7,'Agustus':8,'September':9,'Oktober':10,'November':11,'Desember':12 } rows=[] current_date=None; current_time=None; prize_idx=0 for line in text.splitlines(): line=line.strip() if not line or line.startswith('===') or line.startswith('---'): continue m=re.match(r'Tanggal:\s*(\d{1,2})\s+(\w+)\s+(\d{4})\s+\|\s+Waktu:\s*(\d{2}:\d{2})', line) if m: d, mon, y, t = m.groups() current_date = datetime(int(y), months[mon], int(d)) current_time = t prize_idx=0 continue m=re.match(r'^(\d{4})\s+(.+)$', line) if m and current_date: num=m.group(1) prize_idx += 1 dt = datetime.strptime(current_date.strftime('%Y-%m-%d')+' '+current_time, '%Y-%m-%d %H:%M') rows.append({'dt':dt,'date':current_date.date(),'time':current_time,'prize':prize_idx,'num':num, **{f'd{i+1}':int(num[i]) for i in range(4)}}) df=pd.DataFrame(rows) df.shape, df.head(), df.tail(), df['prize'].value_counts().sort_index(), df['dt'].nunique(), df['dt'].min(), df['dt'].max() ((2079, 9), dt date time prize num d1 d2 d3 d4 0 2026-02-10 21:30:00 2026-02-10 21:30 1 6112 6 1 1 2 1 2026-02-10 21:30:00 2026-02-10 21:30 2 0236 0 2 3 6 2 2026-02-10 21:30:00 2026-02-10 21:30 3 7341 7 3 4 1 3 2026-02-11 03:30:00 2026-02-11 03:30 1 9876 9 8 7 6 4 2026-02-11 03:30:00 2026-02-11 03:30 2 2992 2 9 9 2, dt date time prize num d1 d2 d3 d4 2074 2026-06-07 03:30:00 2026-06-07 03:30 2 4068 4 0 6 8 2075 2026-06-07 03:30:00 2026-06-07 03:30 3 9668 9 6 6 8 2076 2026-06-07 06:30:00 2026-06-07 06:30 1 4278 4 2 7 8 2077 2026-06-07 06:30:00 2026-06-07 06:30 2 4829 4 8 2 9 2078 2026-06-07 06:30:00 2026-06-07 06:30 3 5370 5 3 7 0, prize 1 693 2 693 3 693 Name: count, dtype: int64, 693, Timestamp('2026-02-10 21:30:00'), Timestamp('2026-06-07 06:30:00'))
pythonsorted(df['time'].unique()), df.groupby('time')['dt'].nunique() (['03:30', '06:30', '11:30', '13:30', '17:30', '21:30'], time 03:30 117 06:30 117 11:30 116 13:30 110 17:30 116 21:30 117 Name: dt, dtype: int64)
python# Build session table sorted by dt, prize sessions = sorted(df['dt'].unique()) session_idx = {dt:i for i,dt in enumerate(sessions)} df['session_idx']=df['dt'].map(session_idx) # Check all sessions have 3 prizes assert all(df.groupby('dt').size()==3) # Create arrays [n_sessions, 3 prizes, 4 positions] n=len(sessions) arr=np.zeros((n,3,4), dtype=int) time_arr=[] for dt in sessions: sub=df[df.dt==dt].sort_values('prize') i=session_idx[dt] time_arr.append(sub.iloc[0]['time']) arr[i,:,:] = sub[[f'd{j}' for j in range(1,5)]].to_numpy() time_arr=np.array(time_arr) n, sessions[-3:], time_arr[-5:], arr[-1] (693, [Timestamp('2026-06-06 21:30:00'), Timestamp('2026-06-07 03:30:00'), Timestamp('2026-06-07 06:30:00')], array(['13:30', '17:30', '21:30', '03:30', '06:30'], dtype='<U5'), array([[4, 2, 7, 8], [4, 8, 2, 9], [5, 3, 7, 0]]))
pythonfrom functools import lru_cache def probs_for(i, p, pos, target_time, alpha=1.0, window=60, half_life=90): # i target index, use data indices < i seq=arr[:i,p,pos] digits=np.arange(10) def norm_counts(values, weights=None): cnt=np.ones(10)*alpha if len(values): if weights is None: for v in values: cnt[v]+=1 else: for v,w in zip(values, weights): cnt[v]+=w return cnt/cnt.sum() overall=norm_counts(seq) slot_mask=time_arr[:i]==target_time slot=norm_counts(seq[slot_mask]) recent=norm_counts(seq[-min(window,len(seq)):]) # markov from prev digit prev=arr[i-1,p,pos] trans_values=[] if i>=2: froms=arr[:i-1,p,pos] tos=arr[1:i,p,pos] trans_values=tos[froms==prev] markov=norm_counts(trans_values) # ewma: weights increasing toward recent if len(seq): # weight age: for oldest age len(seq)-1, recent age 0 ages=np.arange(len(seq)-1, -1, -1) weights=0.5**(ages/half_life) ewma=norm_counts(seq, weights) else: ewma=np.ones(10)/10 return overall, slot, recent, markov, ewma def eval_weights(weights, start=120, end=None, window=60, half_life=90): if end is None: end=n logloss=0.0; acc=0; total=0; top3=0 weights=np.array(weights) for i in range(start,end): tt=time_arr[i] for p in range(3): for pos in range(4): comps=probs_for(i,p,pos,tt,window=window,half_life=half_life) pr=sum(w*c for w,c in zip(weights, comps)) pr=pr/pr.sum() actual=arr[i,p,pos] logloss -= math.log(max(pr[actual],1e-12)) if pr.argmax()==actual: acc+=1 if actual in np.argsort(pr)[-3:]: top3+=1 total+=1 return logloss/total, acc/total, top3/total # grid weights step quarters over 5 comps (sum=1) grids=[] steps=[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0] # too many maybe comb 1001. Use 0.1 integer partitions 10 in 5 components = 1001 manageable def integer_partitions(k, m): if m==1: yield (k,) else: for i in range(k+1): for rest in integer_partitions(k-i, m-1): yield (i,)+rest best=[] for part in integer_partitions(10,5): w=tuple(x/10 for x in part) ll,acc,t3=eval_weights(w,start=200,window=60,half_life=90) best.append((ll,acc,t3,w)) best_sorted=sorted(best) best_sorted[:10], best_sorted[-1]
pythonimport re, pandas as pd, numpy as np, math from pathlib import Path from datetime import datetime text=Path('/mnt/data/PRIZE.txt').read_text(encoding='utf-8', errors='replace') months={'Januari':1,'Februari':2,'Maret':3,'April':4,'Mei':5,'Juni':6,'Juli':7,'Agustus':8,'September':9,'Oktober':10,'November':11,'Desember':12} rows=[] current_date=None; current_time=None; prize_idx=0 for line in text.splitlines(): line=line.strip() if not line or line.startswith('===') or line.startswith('---'): continue m=re.match(r'Tanggal:\s*(\d{1,2})\s+(\w+)\s+(\d{4})\s+\|\s+Waktu:\s*(\d{2}:\d{2})', line) if m: d,mon,y,t=m.groups() current_date=datetime(int(y),months[mon],int(d)) current_time=t prize_idx=0 continue m=re.match (693, (2079, 9), Timestamp('2026-02-10 21:30:00'), Timestamp('2026-06-07 06:30:00'), array([[4, 2, 7, 8], [4, 8, 2, 9], [5, 3, 7, 0]]))
pythonalpha=1.0 window=60 half_life=90 start=200 samples=[] # Each sample: components 5x10 probabilities, actual digit for i in range(start,n): tt=time_arr[i] for p in range(3): for pos in range(4): seq=arr[:i,p,pos] # counts with bincount overall=(np.bincount(seq, minlength=10)+alpha); overall=overall/overall.sum() slot_seq=seq[time_arr[:i]==tt] slot=(np.bincount(slot_seq, minlength=10)+alpha); slot=slot/slot.sum() recent_seq=seq[-min(window,len(seq)):] recent=(np.bincount(recent_seq, minlength=10)+alpha); recent=recent/recent.sum() prev=arr[i-1,p,pos] if i>=2: froms=arr[:i-1,p,pos]; tos=arr[1:i,p,pos] trans_seq=tos[froms==prev] else: trans_seq=np.array([], dtype=int) markov=(np.bincount(trans_seq, minlength=10)+alpha); markov=markov/markov.sum() ages=np.arange(len(seq)-1, -1, -1) weights=0.5**(ages/half_life) ewcnt=np.ones(10)*alpha np.add.at(ewcnt, seq, weights) ewma=ewcnt/ewcnt.sum() comps=np.vstack([overall,slot,recent,markov,ewma]) samples.append((comps, arr[i,p,pos])) len(samples) 5916
pythonC=np.stack([s[0] for s in samples]) # S x 5 x 10 actual=np.array([s[1] for s in samples]) S=C.shape[0] # grid weights integer partitions step .1 def partitions(k,m): if m==1: yield (k,) else: for x in range(k+1): for rest in partitions(k-x,m-1): yield (x,)+rest results=[] for part in partitions(10,5): w=np.array(part)/10 P=np.tensordot(C,w,axes=([1],[0])) # S x 10? wait axes: C S,5,10 dot w 5 -> S,10 # tensordot maybe Sx10 pred=P.argmax(axis=1) probs=P[np.arange(S), actual] ll=-np.log(np.maximum(probs,1e-12)).mean() acc=(pred==actual).mean() top3=np.array([actual[i] in np.argsort(P[i])[-3:] for i in range(S)]).mean() results.append((ll,acc,top3,tuple(w))) best=sorted(results, key=lambda x:x[0])[:15] best[:10] [(np.float64(2.311168823566985), np.float64(0.1039553752535497), np.float64(0.3144016227180527), (np.float64(0.8), np.float64(0.0), np.float64(0.1), np.float64(0.1), np.float64(0.0))), (np.float64(2.311291210434333), np.float64(0.10480054090601758), np.float64(0.31659905341446926), (np.float64(0.7), np.float64(0.1), np.float64(0.1), np.float64(0.1), np.float64(0.0))), (np.float64(2.3113410743558993), np.float64(0.10564570655848546), np.float64(0.3116970926301555), (np.float64(0.9), np.float64(0.0), np.float64(0.0), np.float64(0.1), np.float64(0.0))), (np.float64(2.3114342013028772), np.float64(0.10480054090601758), np.float64(0.31068289384719405), (np.float64(0.8), np.float64(0.0), np.float64(0.0), np.float64(0.1), np.float64(0.1))), (np.float64(2.3114465403853695), np.float64(0.10226504394861392), np.float64(0.3110209601081812), (np.float64(0.8), np.float64(0.1), np.float64(0.0), np.float64(0.1), np.float64(0.0))), (np.float64(2.311543799424961), np.float64(0.1039553752535497), np.float64(0.3116970926301555), (np.float64(0.7), np.float64(0.1), np.float64(0.0), np.float64(0.1), np.float64(0.1))), (np.float64(2.3115591941947464), np.float64(0.10311020960108182), np.float64(0.31237322515212984), (np.float64(0.7), np.float64(0.0), np.float64(0.1), np.float64(0.1), np.float64(0.1))), (np.float64(2.3116435940407425), np.float64(0.10513860716700474), np.float64(0.31068289384719405), (np.float64(0.9), np.float64(0.0), np.float64(0.1), np.float64(0.0), np.float64(0.0))), (np.float64(2.3116698042954327), np.float64(0.1039553752535497), np.float64(0.30831643002028397), (np.float64(0.7), np.float64(0.0), np.float64(0.0), np.float64(0.1), np.float64(0.2))), (np.float64(2.311685319876672), np.float64(0.10412440838404327), np.float64(0.31558485463150776), (np.float64(0.6), np.float64(0.1), np.float64(0.1), np.float64(0.1), np.float64(0.1)))]
python# define next prediction distributions using chosen weights best_w=np.array([0.8,0.0,0.1,0.1,0.0]) target_time='11:30' i=n preds={} components_names=['overall','slot','recent60','markov','ewma'] for p in range(3): preds[p+1]=[] for pos in range(4): seq=arr[:i,p,pos] overall=(np.bincount(seq,minlength=10)+alpha); overall=overall/overall.sum() slot_seq=seq[time_arr[:i]==target_time] slot=(np.bincount(slot_seq,minlength=10)+alpha); slot=slot/slot.sum() recent_seq=seq[-min(window,len(seq)):] recent=(np.bincount(recent_seq,minlength=10)+alpha); recent=recent/recent.sum() prev=arr[i-1,p,pos] froms=arr[:i-1,p,pos]; tos=arr[1:i,p,pos] trans_seq=tos[froms==prev] markov=(np.bincount(trans_seq,minlength=10)+alpha); markov=markov/markov.sum() ages=np.arange(len(seq)-1, -1, -1); weights=0.5**(ages/half_life) ewcnt=np.ones(10)*alpha; np.add.at(ewcnt,seq,weights); ewma=ewcnt/ewcnt.sum() comps=np.vstack([overall,slot,recent,markov,ewma]) pr=best_w @ comps pr=pr/pr.sum() top=list(zip(np.argsort(pr)[::-1][:5], np.sort(pr)[::-1][:5])) preds[p+1].append((pr,top, {name: comp for name, comp in zip(components_names, comps)})) # generate top combinations for each prize import itertools, heapq for prize in range(1,4): probs=[preds[prize][pos][0] for pos in range(4)] # top 5 per pos opts=[np.argsort(p)[::-1][:6] for p in probs] combos=[] for digits in itertools.product(*opts): prob=np.prod([probs[j][d] for j,d in enumerate(digits)]) combos.append((''.join(map(str,digits)), prob)) combos=sorted(combos,key=lambda x:x[1],reverse=True)[:10] print('prize',prize) print('top per pos', [[(int(d),float(probs[pos][d])) for d in np.argsort(probs[pos])[::-1][:5]] for pos in range(4)]) print(combos[:10])
python# overall digit counts across all digits all_digits=arr.reshape(-1) freq=np.bincount(all_digits,minlength=10) freq_pct=freq/freq.sum() hot=sorted([(d,int(freq[d]),float(freq_pct[d])) for d in range(10)], key=lambda x:x[1], reverse=True) cold=sorted([(d,int(freq[d]),float(freq_pct[d])) for d in range(10)], key=lambda x:x[1]) hot, cold, freq.sum() ([(1, 918, 0.11038961038961038), (0, 897, 0.10786435786435787), (4, 844, 0.10149110149110149), (2, 828, 0.09956709956709957), (7, 820, 0.0986050986050986), (5, 815, 0.09800384800384801), (6, 814, 0.09788359788359788), (8, 801, 0.09632034632034632), (3, 790, 0.094997594997595), (9, 789, 0.09487734487734488)], [(9, 789, 0.09487734487734488), (3, 790, 0.094997594997595), (8, 801, 0.09632034632034632), (6, 814, 0.09788359788359788), (5, 815, 0.09800384800384801), (7, 820, 0.0986050986050986), (2, 828, 0.09956709956709957), (4, 844, 0.10149110149110149), (0, 897, 0.10786435786435787), (1, 918, 0.11038961038961038)], np.int64(8316))
pythonrecent_sessions=60 recent_digits=arr[-recent_sessions:].reshape(-1) rfreq=np.bincount(recent_digits,minlength=10) rhot=sorted([(d,int(rfreq[d]),float(rfreq[d]/rfreq.sum())) for d in range(10)], key=lambda x:x[1], reverse=True) rhot [(0, 89, 0.12361111111111112), (2, 78, 0.10833333333333334), (5, 76, 0.10555555555555556), (3, 75, 0.10416666666666667), (4, 75, 0.10416666666666667), (9, 72, 0.1), (8, 70, 0.09722222222222222), (6, 68, 0.09444444444444444), (7, 61, 0.08472222222222223), (1, 56, 0.07777777777777778)]
python# Evaluate exact 4D top candidate per prize for chosen weights over last portion def dist_at(i,p,pos,target_time,w=best_w): seq=arr[:i,p,pos] overall=(np.bincount(seq,minlength=10)+alpha); overall=overall/overall.sum() slot_seq=seq[time_arr[:i]==target_time] slot=(np.bincount(slot_seq,minlength=10)+alpha); slot=slot/slot.sum() recent_seq=seq[-min(window,len(seq)):] recent=(np.bincount(recent_seq,minlength=10)+alpha); recent=recent/recent.sum() prev=arr[i-1,p,pos] froms=arr[:i-1,p,pos]; tos=arr[1:i,p,pos] trans_seq=tos[froms==prev] markov=(np.bincount(trans_seq,minlength=10)+alpha); markov=markov/markov.sum() ages=np.arange(len(seq)-1, -1, -1) ewcnt=np.ones(10)*alpha; np.add.at(ewcnt, seq, 0.5**(ages/half_life)); (0, 1479, 0.0)
python# evaluate exact hit if actual is among top 10 combinations per prize def top_combos_for(i,p,target_time,k=10): probs=[dist_at(i,p,pos,target_time) for pos in range(4)] opts=[np.argsort(prob)[::-1][:6] for prob in probs] combos=[] import itertools for digs in itertools.product(*opts): prob=np.prod([probs[j][d] for j,d in enumerate(digs)]) combos.append((''.join(map(str,digs)),prob)) combos=sorted(combos,key=lambda x:x[1], reverse=True)[:k] return [c[0] for c in combos] hit10=0; total=0 for i in range(start,n): for p in range(3): actual_num=''.join(map(str, arr[i,p,:])) if actual_num in top_combos_for(i,p,time_arr[i],k=10): hit10+=1 total+=1 hit10,total,hit10/total (1, 1479, 0.000676132521974307)
Saya olah PRIZE.txt sebagai deret waktu 4D: total terbaca 693 sesi / 2.079 angka prize, dari 10 Februari 2026 21:30 sampai data terakhir 07 Juni 2026 06:30. Data terakhir yang terlihat adalah 4278, 4829, 5370, jadi hasil selanjutnya yang paling logis adalah sesi 07 Juni 2026 11:30. (PRIZE.txt) (PRIZE.txt)
Catatan penting: back-test model menunjukkan pola angka hampir acak. Akurasi top-1 per digit hanya sekitar 10,4%, mendekati peluang acak 10%. Jadi ini prediksi statistik/heuristik, bukan kepastian.
| Prize | Prediksi utama | Alternatif kuat |
|---|---|---|
| Prize 1 | 7091 | 7001, 7096, 7006, 7191 |
| Prize 2 | 4650 | 4620, 4350, 4320, 4050 |
| Prize 3 | 1041 | 1641, 1040, 1640, 1541 |
Prize 1
Prize 2
Prize 3
Metode yang saya pakai setara dengan workflow R: frekuensi digit per posisi + recent window 60 sesi + transisi Markov per posisi, lalu dibobot dari back-test. Hasil paling aman dibaca sebagai kombinasi kandidat, bukan “angka pasti”.